4

I am parsing an XML using Java DOM parser. The XML text contains - (in its Unicode reprsentation -) at many places. The parser fails with this exception:

[Fatal Error] :55479:87: Character reference "&# org.xml.sax.SAXParseException; lineNumber: 55479; columnNumber: 87; Character reference "&#

I have no control over the XML being generated. How to parse the XML with such character references? Is there any work around for this?

user3538357
  • 41
  • 1
  • 4
  • 2
    The parser is telling you that there is a malformed Numeric Character Reference in your document, and giving you the specific line and column where the error exists. Until that is fixed, the document is not XML, no matter what it claims. There is no workaround other than manually fixing the document, or writing some sort of preprocessor that looks for whatever the specific error is and repairs it. – keshlam Apr 16 '14 at 02:31
  • You might have no control over what is being generated, but you should let the people who do have control know that if they think and claim that they are generating XML, they are mistaken and should withdraw the claim. – Michael Kay Apr 16 '14 at 07:40

0 Answers0