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

Namespaces ?

P: n/a
What see sample that show xs:element where the xs namespace =
http://www.w3.org/2001/XMLSchema

However, I see another example with xsi: where xsi =
http://www.w3.org/2001/XMLSchema-instance

What's the difference here? Are there right and wrong namespaces? Is there
a global list of the ones to use? Does the namespace even need to point at
http://www.w3.org.....? Or is this just the accepted way?

Very appreciative,

Mike Morse
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
They are different namespaces that refer to different things.

for more on XML Namespaces, See
http://www.w3.org/TR/REC-xml-names/
http://msdn.microsoft.com/library/en...sinSchemas.asp
http://msdn.microsoft.com/library/en...namespaces.asp
http://www.jclark.com/xml/xmlns.htm

The examples you cited do not "point to" www.w3.org. In fact, XML
Namespaces in general are supposed to be URI's, and are not necessarily
URL's.
The page I referenced above points to RFC2396 which clarifies the
distinction between URI's and URL's.
http://www.faqs.org/rfcs/rfc2396.html

In a nutshell, a URI is an Identifier, whereas a URL is special case of URI
that is also a Locator. My name "Dino Chiesa" is an Identifier, but is
not a Locator. (but, my name is NOT a URI, because it does not conform to
RFC2396). http://www.w3.org is both an identifier and a Locator. (both
a URI and URL). The string "urn:ThisIsMyNamespace" is a URI but not a
URL, as it provides no location information.

It just so happens that the URI's used for XMLSchema and XMLSchema-instance
(and many other XML namespaces) also act as URLs. It need not be so.
Designers often use http:// prefixes in XML namespaces, for a couple
reasons.
1. it makes the doc easy to find. If I want to learn about XML Schema, I
can go to http://www.w3.org/2001/XMLSchema
2. HTTP URLs are universal and hierarchical. For example, a namespace
like http://www.w3.org/2001/XMLSchema indicates that W3C owns it (or
published it), that it was finalized in 2001, etc. A namespace like
http://www.mycompanyname.com/Blah/Foo would indicate that MyCompanyName
specified it. So it's easy to discriminate namespaces this way.

But, on the other hand, dual use URIs tend to confuse people as to the
purpose and nature of XML Namespaces.

Microsoft has tried, in the namespaces it publishes, to use URNs as opposed
to URLs. I think.
For example, the Office Search Pane can interpret documents that conform to
the namespace "urn:Microsoft.Search.Response" . The namespace used in
ADO.NET DataSets is urn:schemas-microsoft-com:xml-msdata .

These are URI's (and URN's) but not URLs.

-D
"Mike Morse" <mi********@micromo.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
What see sample that show xs:element where the xs namespace =
http://www.w3.org/2001/XMLSchema

However, I see another example with xsi: where xsi =
http://www.w3.org/2001/XMLSchema-instance

What's the difference here? Are there right and wrong namespaces? Is there a global list of the ones to use? Does the namespace even need to point at http://www.w3.org.....? Or is this just the accepted way?

Very appreciative,

Mike Morse

Nov 12 '05 #2

P: n/a
Thank you very much, I will look at the resources you gave me.

-mike

"Dino Chiesa [Microsoft]" <di****@online.microsoft.com> wrote in message
news:OQ**************@tk2msftngp13.phx.gbl...
They are different namespaces that refer to different things.

for more on XML Namespaces, See
http://www.w3.org/TR/REC-xml-names/
http://msdn.microsoft.com/library/en...sinSchemas.asp http://msdn.microsoft.com/library/en...namespaces.asp
http://www.jclark.com/xml/xmlns.htm

The examples you cited do not "point to" www.w3.org. In fact, XML
Namespaces in general are supposed to be URI's, and are not necessarily
URL's.
The page I referenced above points to RFC2396 which clarifies the
distinction between URI's and URL's.
http://www.faqs.org/rfcs/rfc2396.html

In a nutshell, a URI is an Identifier, whereas a URL is special case of URI that is also a Locator. My name "Dino Chiesa" is an Identifier, but is
not a Locator. (but, my name is NOT a URI, because it does not conform to
RFC2396). http://www.w3.org is both an identifier and a Locator. (both a URI and URL). The string "urn:ThisIsMyNamespace" is a URI but not a
URL, as it provides no location information.

It just so happens that the URI's used for XMLSchema and XMLSchema-instance (and many other XML namespaces) also act as URLs. It need not be so.
Designers often use http:// prefixes in XML namespaces, for a couple
reasons.
1. it makes the doc easy to find. If I want to learn about XML Schema, I can go to http://www.w3.org/2001/XMLSchema
2. HTTP URLs are universal and hierarchical. For example, a namespace
like http://www.w3.org/2001/XMLSchema indicates that W3C owns it (or
published it), that it was finalized in 2001, etc. A namespace like
http://www.mycompanyname.com/Blah/Foo would indicate that MyCompanyName
specified it. So it's easy to discriminate namespaces this way.

But, on the other hand, dual use URIs tend to confuse people as to the
purpose and nature of XML Namespaces.

Microsoft has tried, in the namespaces it publishes, to use URNs as opposed to URLs. I think.
For example, the Office Search Pane can interpret documents that conform to the namespace "urn:Microsoft.Search.Response" . The namespace used in
ADO.NET DataSets is urn:schemas-microsoft-com:xml-msdata .

These are URI's (and URN's) but not URLs.

-D
"Mike Morse" <mi********@micromo.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
What see sample that show xs:element where the xs namespace =
http://www.w3.org/2001/XMLSchema

However, I see another example with xsi: where xsi =
http://www.w3.org/2001/XMLSchema-instance

What's the difference here? Are there right and wrong namespaces? Is

there
a global list of the ones to use? Does the namespace even need to point

at
http://www.w3.org.....? Or is this just the accepted way?

Very appreciative,

Mike Morse


Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.