473,408 Members | 2,027 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Namespaces ?

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
2 1569
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Steven Bethard | last post by:
In the "empty classes as c structs?" thread, we've been talking in some detail about my proposed "generic objects" PEP. Based on a number of suggestions, I'm thinking more and more that instead of...
24
by: Marcin Vorbrodt | last post by:
Here is an example of my code: //Header file #include <vector> using std::vector; namespace Revelation { // class definitions, etc... // class members are of type std::vector }
3
by: Jim Heavey | last post by:
Trying to get the hang of Namespaces. I have primarly developed in VB and am transitioning to C# and the .Net Environment. I have worked a bit with Java as well in school about a year or so ago....
17
by: clintonG | last post by:
Using 2.0 with Master Pages and a GlobalBaseClass for the content pages. I understand the easy part -- the hierarchical structure of a namespace naming convention -- but the 2.0 IDE does not...
11
by: Random | last post by:
I'm confused about the proper use and usefulness of namespaces. I beleive I understand the purpose is so the developer can put classes within namespaces to essentially organize your code. And I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.