java - Why is ampersand being interpreted as children on text node -


I have an XML file that I am parsing and I have the following tag ...

< Pre> & lt; Desc & gt; /wap/news/text.jsp?sid=242&nid=5662369&cid=5038&scid=-1 & lt; / Desc>

I do not have control over the format of this XML file but I need to explain the content as partial URL which I later add to a base URL and a new file I get.

When I parse it, a tag has a child, a text node whose value is ...

  /wap/news/text.jsp ? Sid = 242  

But the rest line is parsed with the value of the nodes of 6 children on the text node above ...

  Amp; Nid = 566236 9 & amp; CID = 5038 & amp; Skid = -1  

How do I treat this parser as just a text node and '& amp; The symbols form the hair nodes.

The related parsing code is below.

  HTTink Connection C = (HTTP Connection) Connector. Open (inURL.toString (), Connector. RAD); Is = c.openInputStream (); Documentbuilder Factory Factory = Document Builder. Firmware (); Factory.setIgnoringElementContentWhitespace (true); Factory.setAllowUndefinedNamespaces (true); DocumentBuilder Builder = Factory. NE DocumentBuilder (); Document = builder.parse ();  

This is a J2ME code on a Blackberry, so I am quite limited to the API available.

& amp; XML has a special character & amp; Amp; Amp; needs to be avoided as

If someone produces the above text file above, then it is not producing valid XML.


Comments

Popular posts from this blog

php - multilevel menu with multilevel array -

c# - TypeConverter in propertygrid only converts from string, not to -

jQuery UI: Datepicker month format -