Special characters in XHTML - Parse Error

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.

Answers


& 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


Need Your Help

Neo4j Java API: GC overhead limit exceeded after running multiple queries

java neo4j garbage-collection graph-databases

I’m using Neo4j 2.3.0 in Java. I have 16 GB RAM, running the code on MAC OSX Laptop, using "-Xmx12g -Xms12g" as VM arguments.

COUNT rows from multiple joined tables - MSSQL

asp.net sql sql-server count left-join

I'm trying to make a simple forum for a school-project.