J
John_Woo
Hi,
I'm using apache DefaultHandler SAX to interpret xml file.
supposed the xml file as:
<a>....</a>
<a>...</a>
<a>...</a>
....
<a>...</a>
and the dtd as
<!ELEMENT a EMPTY>
namely not allowing PCDATA:
</a>no letter here<a></a>
there are some methods in this handler, such as
public void startElement()
public void endElement( String namespaceURI,
String localName, String qName ) throws SAXException
public void error(SAXParseException e) throws SAXException {
}
...
for every <a></a>, all above methods involved to process them. but the
hanlders reports the error
org.xml.sax.SAXParseException: The content of element type "a" must
match....
at the end of processing xml file.
I'm wondering,
1. why it reports the error that late?
2. how to stop processing xml file whenever error found?
I'm using apache DefaultHandler SAX to interpret xml file.
supposed the xml file as:
<a>....</a>
<a>...</a>
<a>...</a>
....
<a>...</a>
and the dtd as
<!ELEMENT a EMPTY>
namely not allowing PCDATA:
</a>no letter here<a></a>
there are some methods in this handler, such as
public void startElement()
public void endElement( String namespaceURI,
String localName, String qName ) throws SAXException
public void error(SAXParseException e) throws SAXException {
}
...
for every <a></a>, all above methods involved to process them. but the
hanlders reports the error
org.xml.sax.SAXParseException: The content of element type "a" must
match....
at the end of processing xml file.
I'm wondering,
1. why it reports the error that late?
2. how to stop processing xml file whenever error found?