[xml] XML Document Contains Unescaped Predefined Entities



attempting to parse a XML document containing unescaped predefined entities.

XML docuement:

       <a>a's value
          <b>b's value
             <c>& 's value</c>
          </b>
       </a>

Exception:

org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1078)
at SAXLocalNameCount.main(SAXLocalNameCount.java:284)


This was due to unquoted & character in element, <c>.


XML docuement:

       <a>a's value
          <b>b's value <
             <c>& 's value</c>
          </b>
       </a>


Exception:

org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1078)
at SAXLocalNameCount.main(SAXLocalNameCount.java:284)

This was due to unquoted < character in element, <b>.

Need to setup a programmatic process to escape these characters.  
Thanks in advance for suggestions/work-arounds?

-smk



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]