Error while decoding xml. "&" not valid marker. Waiting ";"

47 Views Asked by At

I have a xml file, when I'm trying to decode it.

                XmlElement cmd = data.DocumentElement;
                cmd.InnerXml = WebUtility.HtmlDecode(cmd.InnerXml);

I getting an error "&" is not valid marker. Waiting ";". Xml file

<command type="Order" TZ="180">
<Detail InquiryNo="11100433067" InquiryLineNo="10000" LineNo="80000" ProductNo="1162" ProductName="Код товарной номенклатуры" Size="" Quantity="1" Amount="0" ValuatedAmount="0" Discount="0" CouponCode="20000" Color="" Status="0" Service="0" ExternalBarcode="" Barcode="7500277733715" Type="73" Keep="0" VAT_Rate="0" VAT_Amount="0" ItemNote="5408 03613959805885 8HNp&amp;ie&amp;ZX&quot;E"/>
<Detail InquiryNo="11100433067" InquiryLineNo="10000" LineNo="100000" ProductNo="1162" ProductName="Код товарной номенклатуры" Size="" Quantity="1" Amount="0" ValuatedAmount="0" Discount="0" CouponCode="30000" Color="" Status="0" Service="0" ExternalBarcode="" Barcode="7500277733715" Type="73" Keep="0" VAT_Rate="0" VAT_Amount="0" ItemNote="5408 03614850354540 9BTEXm*GsbOT*"/>
<Detail InquiryNo="11100433067" InquiryLineNo="10000" LineNo="120000" ProductNo="1162" ProductName="Код товарной номенклатуры" Size="" Quantity="1" Amount="0" ValuatedAmount="0" Discount="0" CouponCode="40000" Color="" Status="0" Service="0" ExternalBarcode="" Barcode="7500277733715" Type="73" Keep="0" VAT_Rate="0" VAT_Amount="0" ItemNote="5408 03613959805960 cp&lt;=U8&amp;5FY&quot;K"/>
<Detail InquiryNo="11100433067" InquiryLineNo="10000" LineNo="130000" ProductNo="1212" ProductName="Признак предмета расчета" Size="" Quantity="1" Amount="0" ValuatedAmount="0" Discount="0" CouponCode="40000" Color="" Status="0" Service="0" ExternalBarcode="" Barcode="7500277733715" Type="73" Keep="0" VAT_Rate="0" VAT_Amount="0" ItemNote="1"/>
<Detail InquiryNo="11100433067" InquiryLineNo="10000" LineNo="140000" ProductNo="1162" ProductName="Код товарной номенклатуры" Size="" Quantity="1" Amount="0" ValuatedAmount="0" Discount="0" CouponCode="50000" Color="" Status="0" Service="0" ExternalBarcode="" Barcode="7500277733715" Type="73" Keep="0" VAT_Rate="0" VAT_Amount="0" ItemNote="5408 03613959805885 -./;:&lt;=&gt;?/YTR"/>
</command>
1

There are 1 best solutions below

1
Archiware On

I suppose your XML contains an "&" which might cause problems. There should be &amp; written in the XML instead.

For future reference, in these scenarios it would be much easier to help if you provided (at least partially) the XML you're trying to parse.