Hi Jo, If you're providing a string as the value of the schemaSource property it's supposed to be a valid URI.
"C:Test Demo\4.2testing\tmp\xsd-cache\cached_schema_64465.xsd" isn't a valid URI. With the '\' missing after the 'C:' it doesn't look like a valid Windows file path either. You should either fix up the string to make it a valid URI (e.g. file:///C:/Test%20Demo/4.2testing/tmp/xsd-cache/cached_schema_64465.xsd) or set a java.io.File as the value of schemaSource instead. Thanks. Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] "Jo Vandermeeren" <[EMAIL PROTECTED]> wrote on 09/10/2008 11:05:50 AM: > Hi there, > > I am having the following issue when trying to validate an XML file > using an XSD schema. > This is the error message: "schema_reference.4: Failed to read schema > document 'C:Test Demo\4.2 > testing\tmp\xsd-cache\cached_schema_64465.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>." > > I am creating the SAX parser as follows: > SAXParserFactory factory = > javax.xml.parsers.SAXParserFactory.newInstance(); > factory.setNamespaceAware(true); > factory.setValidating(true); > > SAXParser parser = factory.newSAXParser(); > parser.setProperty("http://java.sun. > com/xml/jaxp/properties/schemaLanguage", > "http://www.w3.org/2001/XMLSchema"); > parser.setProperty("http://java.sun. > com/xml/jaxp/properties/schemaSource", > resolveSchemaSource(schemaSource)); > > The resolveSchemaSource(String) method extracts the schema from the > classpath, copies it to a temporary location on disk and returns the > canonical path of the schema file. > > Are there any other invalid characters that could end up in the path > that should be taken into account? > > Thanks > Jo > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED]