Stripping Invalid XML characters in Java

前端 未结 6 965
野性不改
野性不改 2020-12-04 16:57

I have an XML file that\'s the output from a database. I\'m using the Java SAX parser to parse the XML and output it in a different format. The XML contains some invalid c

6条回答
  •  感动是毒
    2020-12-04 17:19

    Is it possible your invalid characters are present only within the values and not the tags themselves i.e. the XML notionally meets the schema but the values have not been properly sanitized? If so, what about overriding InputStream to create a CleansingInputStream that replaces your invalid characters with their XML equivalents?

提交回复
热议问题