开发者

Special characters in XHTML - Parse Error

开发者 https://www.devze.com 2022-12-30 07:21 出处:网络
When there are special charact开发者_如何学运维ers like & in the xhtml the DOM / SAX parser throws parse exception. The xhtml document is got as an input for my component. I want to ignore such sp

When there are special charact开发者_如何学运维ers like & in the xhtml the DOM / SAX parser throws parse exception. The xhtml document is got as an input for my component. I want to ignore such special characters when i parse. How can i achieve it using DOM/SAX JAVA parser.


& should be encoded as &. If it's not then your XHTML is encoded wrongly. Whatever is writing it should escape these (and other) characters properly according to the XML specification.


How do the "special" characters get into the XHTML? XHTML is meant to be XML. It should be created by tools that understand XML. If you're using string manipulation to create your XHTML, then you're setting yourself up for errors like this.


You can create and store XML's special characters in text fields in XPL - which is just like XML, but allows the special characters in text fields. It's Java based, but you can also run the free version outside of your application and it will create valid XML files for you. eXtensible Process Language

0

精彩评论

暂无评论...
验证码 换一张
取 消