An invalid XML character (Unicode: 0xc) was found

后端 未结 9 2028
傲寒
傲寒 2020-12-02 12:38

Parsing an XML file using the Java DOM parser results in:

[Fatal Error] os__flag_8c.xml:103:135: An invalid XML character (Unicode: 0xc) was found in the ele         


        
9条回答
  •  萌比男神i
    2020-12-02 13:11

    There are a few characters that are dissallowed in XML documents, even when you encapsulate data in CDATA-blocks.

    If you generated the document you will need to entity encode it or strip it out. If you have an errorneous document, you should strip away these characters before trying to parse it.

    See dolmens answer in this thread: Invalid Characters in XML

    Where he links to this article: http://www.w3.org/TR/xml/#charsets

    Basically, all characters below 0x20 is disallowed, except 0x9 (TAB), 0xA (CR?), 0xD (LF?)

提交回复
热议问题