views:

154

answers:

2

When there are special characters 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.

+3  A: 

& 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.

Brian Agnew
+3  A: 

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.

John Saunders