How can I parse XML that confirms to the 1.1 spec using Java and Xerces?

前端 未结 2 837
囚心锁ツ
囚心锁ツ 2020-12-18 08:39

I\'m trying to parse a String which contains XML content which conforms to the XML 1.1 spec. The XML contains character references which are not allowed in the XML 1.0 spec

相关标签:
2条回答
  • 2020-12-18 09:10

    Not sure how to do this with Xerces, but Woodstox supports XML 1.1 out of the box. While it is primarily a Stax parser, it also implements SAX API (since version 3.2).

    0 讨论(0)
  • 2020-12-18 09:13

    See here for a list of all the features supported by xerces. May be below 2 features is what you have to turn on.

    http://xml.org/sax/features/unicode-normalization-checking

    True: Perform Unicode normalization checking (as described in section 2.13 and Appendix B of the XML 1.1 Recommendation) and report normalization errors.

    False: Do not report Unicode normalization errors.

    http://xml.org/sax/features/xml-1.1

    True: The parser supports both XML 1.0 and XML 1.1.
    False: The parser supports only XML 1.0.
    Access: read-only Since: Xerces-J 2.7.0 Note: The value of this feature will depend on whether the parser configuration owned by the SAX parser is known to support XML 1.1.

    0 讨论(0)
提交回复
热议问题