Sounds like the parser is getting stuck in an infinite loop on the second document. The docs do warn [1] users that can happen as a result of turning this feature on but we do try to fix the ones that people have reported. Can you open a JIRA issue to track this problem?
Thanks. [1] http://xerces.apache.org/xerces2-j/features.html#continue-after-fatal-error Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] Stanimir Stamenkov <[EMAIL PROTECTED]> wrote on 09/20/2006 10:40:02 AM: > Xerces 2.8.1: Occasionally a NullPointerException occurs when > parsing using the "continue-after-fatal-error" feature (and after > fatal errors). I'm attaching the stack trace and the sample test > I've used. > > I'm giving the main "test1.xml" here inline: > > -----"test1.xml" > <?xml version="1.0" ?> > <!DOCTYPE test [ > <!ELEMENT test EMPTY> > <!ATTLIST test > decimal-point (.|,) "." > status (OK|ERR|user-defined) "OK" > asdfa CDATA #IMPLIED > > > ]> > <test /> > -----"test1.xml"-- > > Using it I get the NPE. Changing the "asdfa" attribute declaration > name to "asdfb", for example, doesn't cause a NPE. > > Using the "test2.xml" I've attached (which refers to "test2.dtd") > causes the parsing to hang - could be related to the NPE issue as > the conditions are very similar. > > -- > Stanimir > java.lang.NullPointerException > at org.apache.xerces.impl.dtd.DTDGrammar. > getAttributeDeclIndex(DTDGrammar.java:346) > at org.apache.xerces.impl.dtd.XMLDTDProcessor. > attributeDecl(XMLDTDProcessor.java:866) > at org.apache.xerces.impl.XMLDTDScannerImpl. > scanAttlistDecl(XMLDTDScannerImpl.java:1177) > at org.apache.xerces.impl.XMLDTDScannerImpl. > scanDecls(XMLDTDScannerImpl.java:1925) > at org.apache.xerces.impl.XMLDTDScannerImpl. > scanDTDInternalSubset(XMLDTDScannerImpl.java:324) > at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher. > dispatch(XMLDocumentScannerImpl.java:939) > at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl. > scanDocument(XMLDocumentFragmentScannerImpl.java:323) > at org.apache.xerces.parsers.XML11Configuration. > parse(XML11Configuration.java:844) > at org.apache.xerces.parsers.XML11Configuration. > parse(XML11Configuration.java:767) > at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:107) > at org.apache.xerces.parsers.AbstractSAXParser. > parse(AbstractSAXParser.java:1200) > at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser. > parse(SAXParserImpl.java:553) > at net.example.ParsingTest.main(ParsingTest.java:57)//package ; > > import java.io.IOException; > import java.net.URL; > > import javax.xml.parsers.ParserConfigurationException; > import javax.xml.parsers.SAXParserFactory; > > import org.xml.sax.ErrorHandler; > import org.xml.sax.InputSource; > import org.xml.sax.SAXException; > import org.xml.sax.SAXParseException; > import org.xml.sax.XMLReader; > > public class ParsingTest { > > public static void main(String[] args) { > SAXParserFactory spf = SAXParserFactory.newInstance(); > spf.setValidating(true); > > XMLReader xmlReader; > try { > spf.setFeature("http://apache.org/xml/features/" > + "continue-after-fatal-error", true); > xmlReader = spf.newSAXParser().getXMLReader(); > } catch (SAXException ex) { > ex.printStackTrace(); > return; > } catch (ParserConfigurationException ex) { > ex.printStackTrace(); > return; > } > > ErrorHandler errorHandler = new ErrorHandler() { > public void warning(SAXParseException exception) { > log("warning", exception); > } > public void fatalError(SAXParseException exception) { > log("fatal", exception); > } > public void error(SAXParseException exception) { > log("error", exception); > } > private void log(String type, > SAXParseException exception) { > System.err.println("[" + type + "]:" > + exception.getLineNumber() > + ": " + exception); > } > }; > xmlReader.setErrorHandler(errorHandler); > > URL source = ParsingTest.class.getResource("test1.xml"); > InputSource input = new InputSource(source.toExternalForm()); > > try { > xmlReader.parse(input); > } catch (IOException ex) { > ex.printStackTrace(); > } catch (SAXException ex) { > ex.printStackTrace(); > } > } > > } > <?xml version="1.0" ?> > <!DOCTYPE test SYSTEM "test2.dtd"> > <test /> > [attachment "test2.dtd" deleted by Michael Glavassevich/Toronto/IBM] > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
