Digester : Parsing problem ...

P

pgaleas

Hello All,

I have a set of XML files which contain an incorrect attribute
definition:
<F P=10> some text </F>

.... quotes are not defined for the attribute P value.

When I try to parse the documents with Digester, I obtain the following
error message:

Exception in thread "main" org.xml.sax.SAXParseException: Open quote is
expected for attribute "P" associated with an element type "F".
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown
Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1631)
....
....

I don't need really the value of the attribute P. Only is important
the information contained between <F> and </F>.

Is there a way to ignore the attribute definition and parse these
documents without to fix the XML files?

Thank you in advance
Patricio
 
M

Mike Schilling

pgaleas said:
Hello All,

I have a set of XML files which contain an incorrect attribute
definition:
<F P=10> some text </F>

... quotes are not defined for the attribute P value.

When I try to parse the documents with Digester, I obtain the following
error message:

Exception in thread "main" org.xml.sax.SAXParseException: Open quote is
expected for attribute "P" associated with an element type "F".
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown
Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1631)
...
...

I don't need really the value of the attribute P. Only is important
the information contained between <F> and </F>.

Is there a way to ignore the attribute definition and parse these
documents without to fix the XML files?

I don't know of an XML parser that handles ill-formed XML other than by
throwing that sort of exception. You might do better with an HTML parser,
since the quotes are optional is some dialects of HTML.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,235
Latest member
Top Crypto Podcasts_

Latest Threads

Top