I am trying to parse an XML document with a Java DOM (not SAX) API. Whenever the parser encounters an ampersand (&) while parsing node text, it throws an error. I suppose this is resolvable: 1) escaping, 2) encoding, or 3) using another parser.
I am reading an XML document that I have no control over, so I can’t pinpoint where the ampersand appears in the document every time I read it.
The answers I saw to similar questions recommended replacing the entity type when parsing XML, but I'm not sure how I can do this, since it does not even parse when it encounters an XML ampersand.
Any help would be appreciated.
source
share