By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,432 Members | 795 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,432 IT Pros & Developers. It's quick & easy.

How to specify a local (!) Schema file in the same (!) directory as the xml file ?

P: n/a
I would like to validate a xml file against a xsd file on my hard disc.
Ok, I could specify the location of the XSD Schema in the instance of the xml file as follows:

<Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:///D:/tmp/Personschema.xsd">

It works.
But I would like to specify the location of the xsd relative to the xml file.
That means if I move both xml AND xsd schema to another folder the xml file becomes invalid resp.
the validation fails because of a missing xsd file.
On the other hand if i change the Schema location as follows:

<Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Personschema.xsd">

The XSD file is not longer valid itself because "Personschema.xsd" is not a valid URI.
So is there another method to specify the Schema location relatively to the xml file ?

Till

Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ts***@arcor.de (Till Soerensen) writes:
I would like to validate a xml file against a xsd file on my hard disc.
Ok, I could specify the location of the XSD Schema in the instance
of the xml file as follows:
</snip/>
<Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="Personschema.xsd">

The XSD file is not longer valid itself because "Personschema.xsd"
is not a valid URI.


It's fine -- it's a (relative) URI reference, which is allowed, and
should work with any conformant schema processor.

ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.