java - SAXParser '&' concatenation problem -


I am currently using SAXParser with SAXParserFactory, and I want to cut 'string' to '& amp; ; Symbols For example: "The nation has made our world and everything in it" becomes "everything" in it.

Obviously, I do not want to do this. In the XML input, the character can be properly defined as & Amp; amp; How can I fix this?

  Try {SAXParserFactory spf = SAXParserFactory.newInstance (); SAXParser sp = spf.newSAXParser (); / * Get the XMLReader of the SAXParser created by us * / XMLReader r = sp.getXMLReader (); // It handles XML and the Entries array XMLHandler handles = New XMLHandler (); // Register event handlers r.setContentHandler (handler); string URL = "http: //foobar.xml"; r.parse (URL); return handler. Gateentreas ();}  

This is in my default handler class

  .... public zero characters (four f [], integer start, integer length] {string value = new string ( Ch, start, length); if (! Value.trim (.) Equals ("")) {if (present element. Ambal Ignore Case ("TITLE")) {tempEntry.setTitle (value); } ....  

SX API does not guarantee that a given text node is a It will be distributed in pieces, it is allowed to divide into multiple calls for the character () method. Your application has to be adjusted, and it has to be broken down.

Incidentally, the nation has created our world; Everything in it is not a valid XML text piece, it should be the nation made our world & amp; Amp; Everything in it . In this case the SAX Parser has made it the the nation has made our world , and; Amp; and everything in it , and your app is only missing the last one.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -