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.