XML Validation
Added by Anonymous over 19 years ago
Legacy ID: #3169843 Legacy Poster: vanfleet (vanfleet)
Im using Saxon 8.2 with JAXP to validate an xml file against a DTD by applying an empty stylesheet to the XML file with configuration.setValidation(true). If I run this with a compiled XSTL script it works as expected, however if the XSLT script is NOT compiled then I get the following errors: XSLTErrorListener.error: javax.xml.transform.TransformerException: Error reported by XML parser - Error reported by XML parser; SystemID: file:///d:/XPS20/XPSLib/xsl/validate.xsl; Line#: 23; Column#: 15 - org.xml.sax.SAXParseException: Document is invalid: no grammar found. at net.sf.saxon.StandardErrorHandler.reportError(StandardErrorHandler.java:85) at net.sf.saxon.StandardErrorHandler.error(StandardErrorHandler.java:60) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source) at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:212) at net.sf.saxon.event.Sender.send(Sender.java:110) at net.sf.saxon.event.Sender.send(Sender.java:44) at net.sf.saxon.PreparedStylesheet.loadStylesheetModule(PreparedStylesheet.java:174) at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:111) at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:124) at net.sf.saxon.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:79) at Utils.processXML(Unknown Source) at XPSProcessor.validateMasterDoc(Unknown Source) at XPSProcessor.startProcessor(Unknown Source) at XPSProcessor.main(Unknown Source) XSLTErrorListener.error: javax.xml.transform.TransformerException: Error reported by XML parser - Error reported by XML parser; SystemID: file:///d:/XPS20/XPSLib/xsl/validate.xsl; Line#: 23; Column#: 15 - org.xml.sax.SAXParseException: Document root element "xsl:transform", must match DOCTYPE root "null". at net.sf.saxon.StandardErrorHandler.reportError(StandardErrorHandler.java:85) at net.sf.saxon.StandardErrorHandler.error(StandardErrorHandler.java:60) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source) at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:212) at net.sf.saxon.event.Sender.send(Sender.java:110) at net.sf.saxon.event.Sender.send(Sender.java:44) at net.sf.saxon.PreparedStylesheet.loadStylesheetModule(PreparedStylesheet.java:174) at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:111) at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:124) at net.sf.saxon.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:79) at Utils.processXML(Unknown Source) at XPSProcessor.validateMasterDoc(Unknown Source) at XPSProcessor.startProcessor(Unknown Source) at XPSProcessor.main(Unknown Source) Line 23 is the <xsl:transform> element. I can work around this by always using the compiled stylesheet but I thought I would pass this along anyway in case its a bug. Let me know if you need more information. Thanks, David Vanfleet
Replies (2)
RE: XML Validation - Added by Anonymous over 19 years ago
Legacy ID: #3172473 Legacy Poster: Michael Kay (mhkay)
For some reason DTD validation is being requested on the stylesheet source. Looking at the code, I think that this problem has been fixed. Please try again with Saxon 8.4. Michael Kay
RE: XML Validation - Added by Anonymous over 19 years ago
Legacy ID: #3176711 Legacy Poster: vanfleet (vanfleet)
OK, I'll take a look at it with Saxon 8.4 and let you know if it's still a problem. Thanks, David Vanfleet
Please register to reply