2

I'm very new to the schema side of XML. I see that there's a xs:schema tag with attributes xmlns:xs which has a value of some URI. What I don't really know is what does that URI point to? Can I have some XML on my local computer and have it reference that? And if so, what is it pointing at exactly? Following some of the URI's point to web pages but I'm not sure what these pages are for. o.O

I'm also somewhat confused about targetNamespace and xmlsn which appear to usually point to the same thing (same as each other, not same as xs:schema).

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Adrian
  • 10,246
  • 4
  • 44
  • 110

2 Answers2

3

Regarding your first question:

What I don't really know is what does that URI point to?

An XML namespace takes the lexical form of a URI but does not have to be retrievable according to W3C Recommendation: Namespaces in XML 1.0 (Third Edition):

The attribute's normalized value MUST be either a URI reference — the namespace name identifying the namespace — or an empty string. The namespace name, to serve its intended purpose, SHOULD have the characteristics of uniqueness and persistence. It is not a goal that it be directly usable for retrieval of a schema (if any exists).

Regarding your second question:

Can I have some XML on my local computer and have it reference that?

Yes, of course. Read up on xsd:schemaLocation and xsd:noNamespaceSchemaLocation, which provide hints as to where to find an XSD to associate with an XML document.

kjhughes
  • 106,133
  • 27
  • 181
  • 240
3

URI means "Uniform Resource Identifier", whereas URL means "Uniform Resource Locator". The difference is significant: a URI is a name, not an address. A tradition has grown of using namespace names that begin "http", which is a little unfortunate, because it suggests some relationship to the HTTP protocol, but you should ignore that: it's just a string of characters intended to be globally unique.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164