Re: xerces-j validation issues

Hi Jon,

>I have a similar problem. When trying to use .setProperty("
>......external-schemaLocation", ... ) there is a run-time error from the
>parser that I should supply an even numbers of URIs. Does anyone have an
>working example of code to show how it should be done. I am using
>xalan-j_2_4_0 which includes Xerces-Java 2.1.0.
>
When you use the external-schemaLocation property you have to specify 
both a namespace-uri and the url location of your schema. This is why 
the values must come in pairs and hence be of an even number. Example:

If you have schema with the target namespace "www.test.com" and the 
actual schema document is located at "www.test.com/schema.xsd" then your 
external-schemaLocation property should be set as follows:

setProperty("......external-schemaLocation", "www.test.com 
www.test.com/schema.xsd")

if you have more namespaces and locations then they can also be set in 
the same property:

setProperty("......external-schemaLocation", "ns1 loc1 ns2 loc2 ns3 loc3")

but the values must always come in pairs separated by whitespace. The 
property in Xerces works the same as the schemaLocation attribute in W3C 
XML Schema [1].

Cheers,
/Eddie

[1] http://www.w3.org/TR/xmlschema-1/#xsi_schemaLocation

>
>Jon Wise
>
>
>  
>

Received on Sunday, 8 September 2002 21:07:36 UTC