473,406 Members | 2,293 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,406 software developers and data experts.

Are there standard namespaces that don't need URIs?

As I am learning about XML I seen that xmlns is used with a colon after
it as if it were a namespace itself. However, I have never seen a URI
given for it. Is "xmlns" a sort of predefined word in that all XML
software just knows what it means without it needing a URI?

Are there any more of these special words that need no definition within
any schema? I know there are other special words like "element" and
"targetNamespace" but these seem to be defined within the XML Schema
schema definition. It seems that only "xmlns" must be known before
anything else can be known.

Am I totally missing the boat on this or what?
Feb 3 '07 #1
7 1605
Grant Robertson wrote:
As I am learning about XML I seen that xmlns is used with a colon after
it as if it were a namespace itself. However, I have never seen a URI
given for it. Is "xmlns" a sort of predefined word in that all XML
software just knows what it means without it needing a URI?
The relevant specification is the "Namespaces in XML 1.0" specificaton:
<http://www.w3.org/TR/xml-names/>
You will see that <http://www.w3.org/TR/xml-names/#ns-declreserves a
family of attributes for namespace declaration, namely either 'xmlns' or
a qualified name beginning with 'xmlns:'.
<element xmlns="http://example.com/ns1">
is a default namespace declaration.
So any namespace aware XML parser "knows" the meaning of xmlns and
xmlns:some-prefix attributes as declaring XML namespaces.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Feb 3 '07 #2
On Sat, 3 Feb 2007 08:02:34 -0600, Grant Robertson <bo***@bogus.invalid>
wrote:
>As I am learning about XML I seen that xmlns is used with a colon after
it as if it were a namespace itself. However, I have never seen a URI
given for it. Is "xmlns" a sort of predefined word in that all XML
software just knows what it means without it needing a URI?

Are there any more of these special words that need no definition within
any schema? I know there are other special words like "element" and
"targetNamespace" but these seem to be defined within the XML Schema
schema definition. It seems that only "xmlns" must be known before
anything else can be known.
xmlns is a namespace prefix, not a namespace; namespaces are identified
by a URI. Anyway, the xmlns prefix is associated with the URI
http://www.w3.org/2000/xmlns/, and the namespace standard forbids any
other prefix from being associated with that URI. You can get all the
details, including a description of other reserved prefixes, from the
standard at http://www.w3.org/TR/2006/REC-xml-names-20060816/.
--
Eric Amick
Columbia, MD
Feb 3 '07 #3

"Grant Robertson" <bo***@bogus.invalidwrote in message
news:MP************************@news.newsguy.com.. .
As I am learning about XML I seen that xmlns is used with a colon after
it as if it were a namespace itself. However, I have never seen a URI
given for it. Is "xmlns" a sort of predefined word in that all XML
software just knows what it means without it needing a URI?

Are there any more of these special words that need no definition within
any schema? I know there are other special words like "element" and
"targetNamespace" but these seem to be defined within the XML Schema
schema definition. It seems that only "xmlns" must be known before
anything else can be known.

Am I totally missing the boat on this or what?
First of all, any namespace "needs" (has) a namespace-uri. What you are
asking here is not namespaces that don't have uri-s, but *reserved
prefixes*, that must always be associated with specific namespace-uri-s

There are two such reserved prefixes (xml and xmlns) and they are listed in
the Namespaces specification
(http://www.w3.org/TR/xml-names/#sec-namespaces):

"Namespace constraint: Reserved Prefixes and Namespace Names
The prefix xml is by definition bound to the namespace name
http://www.w3.org/XML/1998/namespace. It MAY, but need not, be declared, and
MUST NOT be bound to any other namespace name. Other prefixes MUST NOT be
bound to this namespace name, and it MUST NOT be declared as the default
namespace.

The prefix xmlns is used only to declare namespace bindings and is by
definition bound to the namespace name http://www.w3.org/2000/xmlns/. It
MUST NOT be declared . Other prefixes MUST NOT be bound to this namespace
name, and it MUST NOT be declared as the default namespace. Element names
MUST NOT have the prefix xmlns.

All other prefixes beginning with the three-letter sequence x, m, l, in any
case combination, are reserved. This means that:

a.. users SHOULD NOT use them except as defined by later specifications

b.. processors MUST NOT treat them as fatal errors.

Though they are not themselves reserved, it is inadvisable to use prefixed
names whose LocalPart begins with the letters x, m, l, in any case
combination, as these names would be reserved if used without a prefix. "

So, when using a global attribute like xml:space, one doesn't need to define
the prefix "xml" -- it is known to the parser.

Cheers,

Dimitre Novatchev
Feb 3 '07 #4
In article <MP************************@news.newsguy.com>,
Grant Robertson <bo***@bogus.invalidwrote:
>Is "xmlns" a sort of predefined word in that all XML
software just knows what it means without it needing a URI?
That's the right way to look at it; xmlns is part of the syntax.
There *is* a URI associated with it, which you don't need to declare
(and indeed mustn't) but you can ignore it for most purposes.

The only other prefix that doesn't need to be declared is "xml", as
used in xml:space, xml:lang, xml:base.

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Feb 3 '07 #5
Thanks everyone! I always get the best, right to the point, answers in
this newsgroup. It is such a relief from trying to get any straight
answers in any Microsoft newsgroup.

No matter how many times I go over it I keep forgetting that the prefix
is just a local shorthand within the XML document for the actual
namespace which is the URI. I see the prefix with the colon after it and
think I am seeing a namespace name. Hopefully once I learn enough to
start designing my schema and actual work with XML files more than just
looking at examples, then I will get it through my head.

Thanks again.
Feb 3 '07 #6
I always get the best, right to the point, answers in
this newsgroup. It is such a relief from trying to get any straight
answers in any Microsoft newsgroup.
Probably you haven't tried this Microsoft forum:
XML and the .NET Framework
http://forums.microsoft.com/MSDN/Sho...ID=38&SiteID=1

I'll be glad to answer your questions there, too :o)

Cheers,
Dimitre Novatchev

"Grant Robertson" <bo***@bogus.invalidwrote in message
news:MP************************@news.newsguy.com.. .
Thanks everyone! I always get the best, right to the point, answers in
this newsgroup. It is such a relief from trying to get any straight
answers in any Microsoft newsgroup.

No matter how many times I go over it I keep forgetting that the prefix
is just a local shorthand within the XML document for the actual
namespace which is the URI. I see the prefix with the colon after it and
think I am seeing a namespace name. Hopefully once I learn enough to
start designing my schema and actual work with XML files more than just
looking at examples, then I will get it through my head.

Thanks again.

Feb 4 '07 #7
On 3 Feb, 21:11, Grant Robertson <b...@bogus.invalidwrote:
Thanks everyone! I always get the best, right to the point, answers in
this newsgroup. It is such a relief from trying to get any straight
answers in any Microsoft newsgroup.

No matter how many times I go over it I keep forgetting that the prefix
is just a local shorthand within the XML document for the actual
namespace which is the URI. I see the prefix with the colon after it and
think I am seeing a namespace name. Hopefully once I learn enough to
start designing my schema and actual work with XML files more than just
looking at examples, then I will get it through my head.

Thanks again.
Hi Grant,
It looks like you pretty much understand the namespace thing and just
need more practice. However, just in case a alternative way of
looking at it might be helpful, you might find the approach used by
James Clark on the following page useful:

http://www.jclark.com/xml/xmlns.htm

Perhaps more for the benefit of others that happen to drift this way
in future looking for answers, the most concise description of XML
namespaces I've found so far is:

http://atmanes.blogspot.com/2006/07/...amespaces.html

Cheers,

Pete.
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
for XML to C++ data binding visit
http://www.tech-know-ware.com/lmx
(or http://www.xml2cpp.com)
=============================================

Feb 5 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bill Cunningham | last post by:
I always begin my xml pages as <?xml version="1.0"?> but I've seen different versions called namespaces added like this <xmlns="www.w3.org/1999/xhtml"> or somethnig to that effect the syntax isn't...
70
by: Michael Hoffman | last post by:
Many of you are familiar with Jason Orendorff's path module <http://www.jorendorff.com/articles/python/path/>, which is frequently recommended here on c.l.p. I submitted an RFE to add it to the...
43
by: Steven T. Hatton | last post by:
Now that I have a better grasp of the scope and capabilities of the C++ Standard Library, I understand that products such as Qt actually provide much of the same functionality through their own...
2
by: Mike Morse | last post by:
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 ...
19
by: David Thielen | last post by:
Hi; If there are no namespaces this works fine for me. But if the xml has namespaces, then I get either no node back or an exception. Here is the sample xml: <root xmlns="http://www.test.org"...
36
by: Wilfredo Sánchez Vega | last post by:
I'm having some issues around namespace handling with XML: >>> document = xml.dom.minidom.Document() >>> element = document.createElementNS("DAV:", "href") >>> document.appendChild(element)...
32
by: toolmaster | last post by:
Since many of the modern computer languages have built-in namespace features, I can't understand why not add this feature into standard C. I've heard many people complain of the lacking of...
9
by: hooomee | last post by:
I'm having tons of trouble getting my schema namespace to work. When i point the validator at the following two examples, it gives the error: Warning at (2,2): Could not find schema information...
22
by: David Mathog | last post by:
One thing that keeps coming up in this forum is that standard C lacks many functions which are required in a workstation or server but not possible in an embedded controller. This results in a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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...

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.