[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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
schemalocation local file c
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
http://www.w3.org/2001/XMLSchema-instance.

So your instance document should look like:

<foo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="file:///C:/schema/schema.xsd">
...
</foo>

Or something like:

<foo xmlns="http://www.example.com/"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://www.example.com/
                         file:///C:/schema/schema.xsd">
...
</foo>

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

---
Jeni Tennison
http://www.jenitennison.com/
Received on Wednesday, 12 December 2001 14:20:46 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.