Hello John,

The value of the external-schemaLocation property is a list of pairs of 
URIs (just like the xsi:schemaLocation attribute [1]), where the first of 
each pair is a target namespace and the second of each pair is a schema 
location hint. Did you specify the target namespace before the location 
"conf/BDM-FDDNUServletRequest.xsd"? If not, that probably explains why you 
get the error.

Thanks.

[1] http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#schema-loc

[EMAIL PROTECTED] wrote on 01/12/2005 01:15:59 AM:

> 
> Hi, 
> 
> Apologies if this is an FAQ, I've read a thread in the archive that 
> seems to match my problem but I can't get the fix to work.  The 
> thread was entitled "Validation fails with targetNamespace == 
> default" and lives at:  http://mail-archives.apache.
> org/eyebrowse/ReadMsg?listId=85&msgNo=2861 
> 
> I'm attempting to add a namespace to a schema and instance documents
> that I'm validating on a servlet. 
> 
> I have something like the following as my schema: 
> 
> <xs:schema  xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-Instance";
>                         version="0.9" 
>                         targetNamespace="http://www.mynamespace.com/"; 
>                         xmlns="http://www.mynamespace.com/"; 
>                         elementFormDefault="qualified"> 
> 
>   <xs:element name="Root"> 
>     <xs:complexType> 
>           <xs:choice> 
>                 blah blah blah.. 
> 
> 
> 
> I have an instance document like this: 
> 
> <Root xmlns="http://www.mynamespace.com/";><blah blah blah.. 
> 
> 
> And I'm attempting to set up validation using the following code 
> (and Xerces 2.6.0) : 
> 
>             DocumentBuilderFactory factory = DocumentBuilderFactory.
> newInstance(); 
>             if(schemaLocation != null) { 
>                 factory.setNamespaceAware(true); 
>                 factory.setValidating(true); 
>                 factory.setAttribute("http://apache.
> org/xml/features/validation/schema", Boolean.TRUE); 
>                 factory.setAttribute("http://apache.
> org/xml/properties/dom/document-class-name", "org.apache.xerces.dom.
> PSVIDocumentImpl"); 
>                 factory.setAttribute("http://apache.
> org/xml/properties/schema/external-schemaLocation", schemaLocation); 
>             } 
> 
> 
> I think I've done everything in the checklist mentioned in the 
> archived thread: 
> 
> a) Defined targetNamespace and elementFormDefault on my schema. 
> b) Use namespace defaulting for unprefixed elements in my instance 
document. 
> c) Tell the parser the location of the schema (say, "conf/BDM-
> FDDNUServletRequest.xsd" ). 
> 
> 
> However, validation is failing with the following error: 
> 
> Failed validation with the following errors: 
> Illegal XML: http://www.w3.org/TR/xml-schema-1#SchemaLocation?
> /usr/local/jakarta-tomcat-5.0.18/webapps/BDM-OsirisServer/conf/BDM-
> FDDNUServerRequest.xsd 
> Illegal XML: cvc-elt.1: Cannot find the declaration of element 'Root'. 
> 
> 
> Does this mean that it either can't find the schema because the 
> namespace it's using is 
"http://www.w3.org/TR/xml-schema-1#SchemaLocation
> " instead of the default one mentioned in the instance document? 
> 
> Or does it mean that it's found the schema and I've missed something
> in my instance document? 
> 
> Any hints, pointers or tips as how to get this to validate would be 
> gratefully appreciated. 
> 
> Thanks for your time, 
> 
> John Greenhow 
> 

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to