You need to sign in to do that
Don't have an account?

XML parsing error
Hi,
I am getting following error while using the parse xml.
Exception
null Exception: Failed to parse XML due to: entity reference name can not contain character ' (position: TEXT seen ...<WKItemDescBaseLang>m&h ... @6:37)
XML:
<Header>
<ItemID>
<ID>SOFT-FAN-LTS-V3.00-AMADA</ID>
</ItemID>
<WKItemDescBaseLang>m&h MEASURING CYCLES "LASER TOOL MEASUREMENT"</WKItemDescBaseLang>
<BaseUOMCode>EA</BaseUOMCode>
<LotControlIndicator>1</LotControlIndicator>
</Header>
Apex:
Dom.Document doc = new Dom.Document();
doc.load( xml );
This error is due to & symbol in xml. But i'm uanble to fix this issue.
Thanks
Ravi
I am getting following error while using the parse xml.
Exception
null Exception: Failed to parse XML due to: entity reference name can not contain character ' (position: TEXT seen ...<WKItemDescBaseLang>m&h ... @6:37)
XML:
<Header>
<ItemID>
<ID>SOFT-FAN-LTS-V3.00-AMADA</ID>
</ItemID>
<WKItemDescBaseLang>m&h MEASURING CYCLES "LASER TOOL MEASUREMENT"</WKItemDescBaseLang>
<BaseUOMCode>EA</BaseUOMCode>
<LotControlIndicator>1</LotControlIndicator>
</Header>
Apex:
Dom.Document doc = new Dom.Document();
doc.load( xml );
This error is due to & symbol in xml. But i'm uanble to fix this issue.
Thanks
Ravi
Can you please try something like this?
String str = '<Header>
<ItemID>
<ID>SOFT-FAN-LTS-V3.00-AMADA</ID>
</ItemID>
<WKItemDescBaseLang>m&h MEASURING CYCLES "LASER TOOL MEASUREMENT"</WKItemDescBaseLang>
<BaseUOMCode>EA</BaseUOMCode>
<LotControlIndicator>1</LotControlIndicator>
</Header>';
str = str.replace('&','&');
Dom.Document doc = new Dom.Document();
doc.load( str );