Willard Handley
asked on
JAXB XML Parsing Question
Is there any way to configure JAXB to, during parsing of an xml document, ignore any text following the closing tag? It seems to ignore any number of spaces following the closing tag, but even one non-space character causes it to throw a SAXParseException. We have a few xml documents with characters following the closing tag, but otherwise they are fine. Until we can clean them up, it would be great to be able to throw a switch somewhere to say, when you reach the closing tag, forget anything that might be beyond it. This exception is being thrown durng unmarshalling.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yes -- I already gave that answer.
My point was not about scrubbing it per se but rather about the document not being an XML document, hence XML parsing not applicable.
XML docs come in many forms. It's still an XML doc even if it has some characters in the file after the closing tag. It is not a well-formed XML doc, which is what the asker was asking about.
As you get more experience with XML docs, you'll find that many are not well-formed, and the developers have to have strategies to deal with that.
As you get more experience with XML docs, you'll find that many are not well-formed, and the developers have to have strategies to deal with that.
"Definition: A data object is an XML document if it is well-formed, as defined in this specification.", from here http://www.w3.org/TR/REC-xml/#sec-well-formed.
Hence not well formed - not an XML
Hence not well formed - not an XML
Hi there
even if there gs a white space before the <xml tag in the document the sax parser will fail
better we send a well formatted xml to parser . open the xml in a browser to if its valid oNe Or not
good luck
even if there gs a white space before the <xml tag in the document the sax parser will fail
better we send a well formatted xml to parser . open the xml in a browser to if its valid oNe Or not
good luck
Either the document needs to be made valid XML by scrubbing it or a non-XML parser used.
Problems of this sort can be expected when working with SGML documents that may look like XML but are not well formed.