I have limited knowledge of XML/Schema files.
So this should be a fairly simple question.
How do you specify a local file for the schemaLocation?
<?xml version="1.0"?>
<note
xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com note.xsd">
...
</note>
This is a sample from http://www.w3.org and the part that specifies schema is in schemaLocation.
I tried looking at the documentation, but how can you specify a local file?
Something like
xsi:schemaLocation="../relativepath/schemafolder not.xsd">
Thanks
schemaLocationhas to contain two values separated by whitespace: the namespace URI (this doesn’t change) and the schema url.So in your case
Don’t be fooled by the namespace URI being a seemingly valid http url, that’s just one of the little madnesses XML people invented. 🙂
Actually, you can specify schemas for several namespaces in one
schemaLocation:(I also advise you to use relative paths with care: while they are extremely useful when you move your files around but still validate it with the same code (or tool), when you deploy your validation code in an application, the “working directory” might not be what you expected. That is not to say you shouldn’t use relative paths, just to be aware of this when you get a weird looking exception about the schema not found.)