I am attempting to do basic schema-validation of xml data using a DOMParser, (latest Apache). I am using an InputSource wrapping a byte full of XML data, i.e. not an XML file. When validation is turned OFF, the parser is happy and parses the data fine. But when trying to validate the data, the parser always throws the SAXExceptions "Document is invalid: no grammar found." and "Document root element "transmittal", must match DOCTYPE root "null". ...implying to me that it cannot locate either the schema schema or the instance schema The root node attributes in the XML data are: <rootNodeName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="rootNodeName.xsd"> I have tried every form for specifying the noNamespaceSchemaLocation that I can think of... For example: - fully qualified path - "file:rootNodeName.xsd" - setting the systemId (of the InputSource) to the base path of the schema file location - ??? Any ideas on how I have to specify this information? TIA jr
Chicken Farmer ()
Joined: May 08, 2001
How are you turning validation on? Are you setting features?
Joined: Jan 23, 2002
As Jason implied, perhaps you have forgotten to set the feature for *schema* validation ("http://apache.org/xml/features/validation/schema").