Parsing XML file containing HTML entities in Java without changing the XML

前端 未结 6 1285
一个人的身影
一个人的身影 2020-12-05 18:53

I have to parse a bunch of XML files in Java that sometimes -- and invalidly -- contain HTML entities such as , > and so forth. I

6条回答
  •  旧时难觅i
    2020-12-05 19:34

    Just to throw in a different approach to a solution:

    You might envelope your input stream with a stream inplementation that replaces the entities by something legal.

    While this is a hack for sure, it should be a quick and easy solution (or better say: workaround).
    Not as elegant and clean as a xml framework internal solution, though.

提交回复
热议问题