Hi All, I am using xerces 1_4_3 and I am unable to validate my instance document. I get the following errors. I tried setting xsi:noNamespaceSchemaLocation (validate1.xml below) to no avail. Any clues?
Thanks in advance, Eva Flora P.S. Enclosed are: validate.xsd validate.xml validate1.xml Validate.java error messages ====error messages===== Error: URI=file:D:/dev/bmsrc/packages/validate.xml Line=2: Element type "record" must be declared. Error: URI=file:D:/dev/bmsrc/packages/validate.xml Line=3: Element type "recordName" must be declared. Error: URI=file:D:/dev/bmsrc/packages/validate.xml Line=4: Element type "comment" must be declared. ====validate.xsd=== <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:test="http://eva.com/eng/test" targetNamespace="http://eva.com/eng/test" elementFormDefault="qualified" attributeFormDefault="unqualified"> <element name="record" type="test:RecordType"> <complexType name="RecordType"> <element name="recordName" type="string"> <element name="comment" type="string"> </complexType> <schema> ====validate.xml===== <?xml version="1.0"?> <record xmlns="http://eva.com/eng/test"> <recordName>Some Name</recordName> <comment>Some Comment</comment> </record> ====validate1.xml===== <?xml version="1.0"?> <record xmlns="http://eva.com/eng/test" xsi:noNamespaceSchemaLocation="validate.xsd"> <recordName>Some Name</recordName> <comment>Some Comment</comment> </record> =====Validate.java==== package com.bluemartini.test.xml; import java.io.*; import org.w3c.dom.*; import org.xml.sax.SAXParseException; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.ParserConfigurationException; /* * Sample test case * Takes in an XML document and validates it via DOM * */ public class Validate { public static void main(String[] argv) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); factory.setValidating(true); DocumentBuilder builder = factory.newDocumentBuilder(); File temp = new File("validate.xml"); Document doc = builder.parse(temp); } catch (Exception e) { e.printStackTrace(); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
