Reputation: 14899
I'm calling an external (3rd party) web service which is returning xml containing namespaces like such:
...
xmlns:gml="http://www.opengis.net/gml"
xmlns:wrs="http://www.opengis.net/cat/wrs/1.0"
xmlns:rim="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0"
...
I'm interested in the last namespace that starts with urn:oasis.
how do validators know how to validate the file if there is no location specified?
I know the first ones don't have location specified either as they are just a namespace.
Could you elaborate on the following statement made in this article:
use URNs if your organization has a means of managing and resolving a suitable class of URN
How do these validators work without locations?
Upvotes: 1
Views: 237
Reputation: 2998
To specify a schema location for validation purposes, you have different approaches :
With XML Schema :
For this second case, you have to use the following namespace : xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
. In this namespace, you have two attributes dedicated to validation : schemaLocation
and noNamespaceSchemaLocation
.
schemaLocation
with the following syntax : xsi:schemaLocation="namespaceURI1 linkToTheSchema1 namespaceURI2 linkToTheSchema2..."
. Each schema declaration is composed of 2 parts separated with a space character: the namespace and the URI that pointed to the file.With other schema langages (Relax NG, schematron)
You can always use the first point above : telling your implementation with schema you want to use.
In the XML file : W3C has published a note already implemented in some XML IDE that allows to add a processiog instruction called xml-model to give access to shcemas. See here : http://www.w3.org/TR/xml-model/.
Upvotes: 2