W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2001

Re: Using XML Schema in local directory

From: Jeni Tennison <jeni@jenitennison.com>
Date: Wed, 12 Dec 2001 19:20:42 +0000
Message-ID: <10012645563.20011212192042@jenitennison.com>
To: Lau Chung Sing <singlau_lcs@yahoo.com>
CC: xmlschema-dev@w3.org
Hi Carter,

> I would like to ask if I have a XML schema (let say put in
> c:\schema\schema.xsd), can I set the above path in the namespace of
> the XML file I would like to validate and then parse the file?

To link from the instance XML document to the schema document, you
need to use the xsi:schemaLocation or xsi:noNamespaceSchemaLocation
attributes (depending on whether or not your markup language uses a
namespace).  The xsi:* attributes are all in the namespace

So your instance document should look like:

<foo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

Or something like:

<foo xmlns="http://www.example.com/"

And if the latter then the xs:schema element in the schema at
schema.xsd should have a targetNamespace attribute equal to
'http://www.example.com/' (the namespace of the foo element).

I hope that helps,


Jeni Tennison
Received on Wednesday, 12 December 2001 14:20:46 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:54 UTC