Situation: I'm using Xerces 2.0 and trying to parse/validate an XML document against a schema. Here are the xml and schema files:
foo.xsd: -------- <?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xsd:element name="request" type="requestType" /> <xsd:simpleType name="TF"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="T" /> <xsd:enumeration value="F" /> </xsd:restriction> </xsd:simpleType> <xsd:complexType name="requestType"> <xsd:sequence> <xsd:element name="clientID" type="xsd:string"/> <xsd:element name="password" type="xsd:string"/> <xsd:element name="flag" type="TF"/> </xsd:sequence> </xsd:complexType> </xsd:schema> foo.xml: ------- <?xml version="1.0" encoding="UTF-8"?> <request xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='foo.xsd'> <clientID>ABD</clientID> <password>ABD</password> <flag>Green</flag> </request> I create the Parser using JAXP, and the document handler interface: SAXParserFactory parserFactory = SAXParserFactory.newInstance(); parserFactory.setNamespaceAware(true); parserFactory.setValidating(true); SAXParser theParser = parserFactory.newSAXParser(); I call parse passing an InputSource created from "foo.xml" and and a class implementing the DefaultHandler interface. Here is the eror I get: error() LINE: 1 org.xml.sax.SAXParseException: Document is invalid: no grammar found. error() LINE: 1 org.xml.sax.SAXParseException: Document root element "request", must match DOCTYPE root "null". Any ideas what I am doing wrong? Thanks --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
