Hi, I have a problem that was discussed here allready a few times but either it some kind of bug or I am just to dumb to use the SAXParser.
I have several documents with no namespaces. They have several schemas to check against and I want to use an EntityResolver do put out the InputSource of that matching schemas. But since moving from the DOMParser to the SAXParser (since I don't need to change the trees) the EntityResolver is never called anymore. This works correctly with DOMParser in Xerces 2.2.1 and does not function with SAXParser of Xerces 2.2.1 and 2.5. What a preconditions to have MyEntityResolver called? Sample XML file source: <?xml version="1.0" encoding="iso-8859-1"?> <mycoreobject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MyCoReDemoDC_LegalEntity.xsd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xml="http://www.w3.org/XML/1998/namespace" ID="MyCoReDemoDC_LegalEntity_1" label="Jens Kupferschmidt"> xsi:noNamespaceSchemaLocation gives the filename the EntityResolver needs to know to find the schema file. As it doesn't call it it tries to find the schema in the current working directory... Here is the output of the 2.2.1 SAXParser: [java] WARN demo_dc_legal_01.xml: line=8 : column=30 : message=schema_reference.4: Failed to read schema document 'MyCoReDemoDC_LegalEntity.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. [java] org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'MyCoReDemoDC_LegalEntity.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. [java] at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:232) [java] at org.apache.xerces.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:141) [java] at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:377) [java] at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:315) [java] at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaWarning(XSDHandler.java:1975) [java] at org.apache.xerces.impl.xs.traversers.XSDHandler.getSchema(XSDHandler.java:1386) [java] at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:368) [java] at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:502) [java] at org.apache.xerces.impl.xs.XMLSchemaValidator.findSchemaGrammar(XMLSchemaValidator.java:2367) [java] at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1764) [java] at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:697) [java] at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:313) [java] at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(XMLNSDocumentScannerImpl.java:610) [java] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1608) [java] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:346) [java] at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:529) [java] at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:585) [java] at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152) [java] at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1142) [java] at org.jdom.input.SAXBuilder.build(SAXBuilder.java:370) Sorry if my problem sounds well known to you allready but trying three days allready I'm not getting near to a solution yet. kindly Thomas Scheffler --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
