| Author |
Issues parsing XML
|
G Singh
Greenhorn
Joined: Oct 29, 2008
Posts: 6
|
|
Hi I am trying to parse the following xml My parsing code is However I get the following error Does anyone have any suggestions on why its tripping on the "qp" parameter
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
It's because the XML is malformed. The ampersands (&) in that text node aren't escaped properly.
|
 |
Yves Zoundi
Ranch Hand
Joined: Aug 31, 2008
Posts: 47
|
|
Replace by . Remove the + there, all together with no space [ October 30, 2008: Message edited by: Yves Zoundi ] [ October 30, 2008: Message edited by: Yves Zoundi ]
|
Author of VFSJFileChooser and XPontus XML Editor
|
 |
G Singh
Greenhorn
Joined: Oct 29, 2008
Posts: 6
|
|
|
Thanks so much for your help, however I don't have control over the XML source, is there any alternatives. (I'm using dom4j to parse)
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
Originally posted by G Singh: Thanks so much for your help, however I don't have control over the XML source, is there any alternatives. (I'm using dom4j to parse)
So you are downloading this malformed XML from somebody else's site? Then you must call them up and tell them about that. Get them to fix their bad outputs. There aren't any parsers that will fix up malformed XML. That's because the original XML recommendation basically forbids them from doing that. So it's the responsibility of the people producing an XML document to make sure that it's a well-formed document. Don't let people get away with irresponsible XML. However in the meantime there's nothing stopping you from using non-XML methods to read that document. You can scan for < followed by an element name, and so on, using ordinary Java I/O and string handling methods. But don't expect any XML parser to handle it.
|
 |
 |
|
|
subject: Issues parsing XML
|
|
|