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

T

Till Soerensen

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
 
H

Henry S. Thompson

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="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: (e-mail address removed)
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top