I am currently using SAXParser with SAXParserFactory, and I ran into a problem when strings were cut into '&' characters. For example: "A nation created by our world and everything in it" becomes "everything in it."
Obviously, I do not want this to happen. In xml input, the character is correctly escaped as & . How can i solve this?
try{ SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader r = sp.getXMLReader();
I have this in my DefaultHandler class
.... public void characters( char ch[], int start, int length ){ String value = new String( ch , start , length ); if(!value.trim().equals("")) { if( currentElement.equalsIgnoreCase("TITLE") ) { tempEntry.setTitle(value); } ....
source share