You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by ch...@e-markets.com on 2001/10/22 18:09:48 UTC

Validating Documents with Relative Schema 'includes'...

Howdy all,

I'm running into a problem in document validation, and I have not found
anything that points me in the right direction...

I am validating a document against a schema that has multiple 'includes',
to wit:
---
<xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema">
	<xsd:include schemaLocation = "cCertificateInformation.xsd"/>
	<xsd:include schemaLocation = "cCommodityInformation.xsd"/>
	<xsd:include schemaLocation = "cContactInformation.xsd"/>
	<xsd:include schemaLocation = "cLocationInformation.xsd"/>
	<xsd:include schemaLocation = "cEntityInformation.xsd"/>
---

Now, when validating the document, I use the Xerces property
---
---

The validation is able to identify the 'QualityCertificate.xsd'file, but
validation gives the following errors:

[Warning] :0:0: File
"file:///C:/agxml/NamespaceExamples/cCertificateInformation.xsd" not found.


[Warning] :0:0: File
"file:///C:/agxml/NamespaceExamples/cCommodityInformation.xsd" not found.

[Warning] :0:0: File
"file:///C:/agxml/NamespaceExamples/cContactInformation.xsd" not found.
---

(i.e. the validator is searching for the "included" schema files in the
directory of the java program, not the schema location itself.)

So, my question boils down to this;

-> How do I specify an included schema without 'coding' the directory path
into each and every file?  (This would likely not work well as I move
schemas from my local hard drive to a production 'Big Box' to a website,
etc...)

Anyone run into these problems?

Thanks, 

Chad

---
Chad Thompson
chad.thompson@e-markets.com


parser.setProperty("http://apache.org/xml/properties/schema/external-noName
spaceSchemaLocation", "file:///C:/agxml/schemas/QualityCertificate.xsd");




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Validating Documents with Relative Schema 'includes'...

Posted by "David A. Riggs" <dr...@asset.com>.
I'm running into the same problem. I've been trying to stick to
the JAXP API, and if I can't find a better solution, I'm going
to have to use some trickery with

javax.xml.parsers.DocumentBuilder.parse(java.io.InputStream is,
java.lang.String systemId)

where systemId is the base path to resolve URI's. If you find
a better solution, (it seems like the URI's should be resolved
from the location of the including schema) please let me know.

David A. Riggs

chad.thompson@e-markets.com wrote:

> Howdy all,
>
> I'm running into a problem in document validation, and I have not found
> anything that points me in the right direction...
>
> I am validating a document against a schema that has multiple 'includes',
> to wit:
> ---
> <xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema">
>         <xsd:include schemaLocation = "cCertificateInformation.xsd"/>
>         <xsd:include schemaLocation = "cCommodityInformation.xsd"/>
>         <xsd:include schemaLocation = "cContactInformation.xsd"/>
>         <xsd:include schemaLocation = "cLocationInformation.xsd"/>
>         <xsd:include schemaLocation = "cEntityInformation.xsd"/>
> ---
>
> Now, when validating the document, I use the Xerces property
> ---
> ---
>
> The validation is able to identify the 'QualityCertificate.xsd'file, but
> validation gives the following errors:
>
> [Warning] :0:0: File
> "file:///C:/agxml/NamespaceExamples/cCertificateInformation.xsd" not found.
>
> [Warning] :0:0: File
> "file:///C:/agxml/NamespaceExamples/cCommodityInformation.xsd" not found.
>
> [Warning] :0:0: File
> "file:///C:/agxml/NamespaceExamples/cContactInformation.xsd" not found.
> ---
>
> (i.e. the validator is searching for the "included" schema files in the
> directory of the java program, not the schema location itself.)
>
> So, my question boils down to this;
>
> -> How do I specify an included schema without 'coding' the directory path
> into each and every file?  (This would likely not work well as I move
> schemas from my local hard drive to a production 'Big Box' to a website,
> etc...)
>
> Anyone run into these problems?
>
> Thanks,
>
> Chad
>
> ---
> Chad Thompson
> chad.thompson@e-markets.com
>
> parser.setProperty("http://apache.org/xml/properties/schema/external-noName
> spaceSchemaLocation", "file:///C:/agxml/schemas/QualityCertificate.xsd");
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org

--
David A. Riggs
Science Applications International Corporation - SAIC
 (304)284-9000x201                  driggs@asset.com



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org