I have a piece of XML that is prefixed with an "a:". I incorporated a regular expression removing the undeclared prefix "a:" from the xml in order for me to easily serialise it into an object, however when doing so i seem to remove the closing tag for "ManagedInstallModuleQuantity".
Can anyone help
var finalXml = Regex.Replace(formatedXml, @"<(/?)\w+:(\w+/?) ?(\w+:\w+.*)?>", "<$1$2>");
XML Before removal:
<GetAppointmentDetailsResult>
<Status>
<Errors/>
<HasErrors>false</HasErrors>
</Status>
<a:Action>Provide</a:Action>
<a:AddressKey>A00008222007</a:AddressKey>
<a:AppointmentType>Standard</a:AppointmentType>
<a:EarliestAppointmentDetails>
<a:AppointmentDate>2019-10-29T00:00:00</a:AppointmentDate>
<a:AppointmentTimeSlot>AM</a:AppointmentTimeSlot>
</a:EarliestAppointmentDetails>
<a:HomeWiringSolutionOption>NotSet</a:HomeWiringSolutionOption>
<a:ManagedInstallModuleQuantity i:nil=\"true\" />
<a:NumberOfLines>1</a:NumberOfLines>
<a:PCPOnlyInstall>No</a:PCPOnlyInstall>
<a:ReservedAppointmentDetails>
<a:AppointmentDate>2019-11-25T00:00:00</a:AppointmentDate>
<a:AppointmentTimeSlot>AM</a:AppointmentTimeSlot>
</a:ReservedAppointmentDetails>
<a:ServiceLevel>CareLevel2</a:ServiceLevel>
<a:ServiceType>FTTCSim2</a:ServiceType>
<a:Technology>VDSL</a:Technology>
</GetAppointmentDetailsResult>
XML after regular expression implementation:
<GetAppointmentDetailsResult>
<Status>
<Errors/>
<HasErrors>false</HasErrors>
</Status>
<Action>Provide</Action>
<AddressKey>A00008222007</AddressKey>
<AppointmentType>Standard</AppointmentType>
<EarliestAppointmentDetails>
<AppointmentDate>2019-10-29T00:00:00</AppointmentDate>
<AppointmentTimeSlot>AM</AppointmentTimeSlot>
</EarliestAppointmentDetails>
<HomeWiringSolutionOption>NotSet</HomeWiringSolutionOption>
<ManagedInstallModuleQuantity>