Hi Adrian,

Adrian Herscu <[EMAIL PROTECTED]> wrote on 03/19/2006 03:24:26 PM:

> Hi all,
> 
> It seems like the xsi:schemaLocation takes precedence over the
> http://apache.org/xml/properties/schema/external-schemaLocation
> property. Is it by design?

No.

> Why?

You didn't state which version of Xerces-J you tried this with. Xerces 
2.6.0, 2.6.1 and 2.6.2 had a bug (see 
http://issues.apache.org/jira/browse/XERCESJ-994) which caused the 
external-schemaLocation property to be ignored when the parser is re-used. 


It should work with Xerces 2.7 and up.

> I am trying to use ANT's <xmlvalidate> task this way:
> 
> <xmlvalidate>
>   <fileset dir="${mySourceDirectory}" includes="${myXmlFiles}" />
> 
>   <attribute
>     name="http://xml.org/sax/features/validation";
>     value="true" />
>   <attribute
>     name="http://apache.org/xml/features/validation/schema";
>     value="true" />
>   <attribute
>     name="http://xml.org/sax/features/namespaces";
>     value="true" />
> 
>   <property
> name="http://apache.org/xml/properties/schema/external-schemaLocation";
>     value="${mySchema}" />
> </xmlvalidate>
> 
> My XML files declare a schema location:
> <myrootelm xsi:schemaLocation="mynamespace
> http://localhost:8080/mynamespace/MySchema.xsd"; ...>
> 
> The validation fails with the following log:
> 
> [xmlvalidate] mypath/MyFile.xml:1:1:
> 
http://www.w3.org/TR/xml-schema-1#SchemaLocation?myschemapath/MySchema.xsd
> [xmlvalidate] mypath/MyFile.xml:8:332: schema_reference.4: Failed to
> read schema document 'http://localhost:8080/mynamespace/MySchema.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>.
> [xmlvalidate] mypath/MyFile.xml:8:332: cvc-elt.1: Cannot find the
> declaration of element 'myrootelm'.
> 
> The schema is not available on the server (i.e. at
> http://localhost:8080/mynamespace/MySchema.xsd) but I did not want to
> validate using that schema either.
> 
> Please help,
> Adrian.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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