OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Namespaces and other stuff

In the example you quote, the part


indicates that elements with names prefixed html: belong in a namespace
"any-old-bollocks". The other namespace declaration does not have a prefix
and so is the default for the element "article" and all its descendants. Any
unprefixed element belongs in this namespace. An instance document might
contain the following:

<article xmlns="http://www.xml.com/namespaces/first-x"
	<title>Introduction to Namespaces</title>
	<html:p>This is an intro to namespaces with two paragraphs</html:p>
	<html:p>That was the first, this is the second</html:p>

There are two "p" elements in the HTML (or "any-old-bollocks") namespace and
elements "article" and "title" in the "first-x" namespace. The purpose of
the namespaces is to make sure that element names are unique. There could be
a further element "p":

	<title>Introduction to Namespaces</title>
	<html:p>This is an intro to namespaces with two paragraphs</html:p>
	<html:p>That was the first, this is the second</html:p>
	<p>This element is in the default namespace and is not part of HTML</p>

Namespaces also apply to attribute names.

I'm sure there are good introductory articles on the web. But why not get a
good book like Beginning XML (Wrox Press). If you get it through
www.alphaxml.com/bookshop/ the commission from Amazon goes to charity.

Paul Spencer
CTO, alphaXML Ltd
alphaXML is recruiting XML consultants and developers
+44 (0)1491 630053

-----Original Message-----
From: Guillermo J. HOYOS RIVERA [mailto:ghoyos@laas.fr]
Sent: 14 May 2001 17:41
To: 'xml-dev@lists.xml.org'
Cc: Guillermo de Jesús HOYOS RIVERA
Subject: Namespaces and other stuff


		As normally happens in this kind of lists, I am writing you to ask you a
naďve question. I am new to XML, and I have passed the last three weeks in
browsing the web and reading some XML, CSS, XSL, etc. stuff. I have almost
understood all the material (I think), however, although I have read some
stuff about namespaces, I haven arrived to understand how does I work.

		In an example XML page I found a reference like the next:

<article xmlns="http://www.xml.com/namespaces/first-x"

		Could some one of you explain me a little beat what does this thing mean,
how does it work, where are stored the "predefined" namespaces, etc, etc.?

		One other thing. If some one of you knows (I think yes) where can I find
commented XML programming examples, I will thank you to share them with me.

		Thanks in advance, and best regards.

		Guillermo Hoyos.

Guillermo de Jesús HOYOS RIVERA
Doctorant du LAAS-CNRS, groupe OLC
7, Avenue Colonel Roche, bureau A43
31077, Toulouse, FRANCE
Tel. (+33|0) 5 61 33 62 63
Fax. (+33|0) 5 61 33 64 11

The xml-dev list is sponsored by XML.org, an initiative of OASIS

The list archives are at http://lists.xml.org/archives/xml-dev/

To unsubscribe from this elist send a message with the single word
"unsubscribe" in the body to: xml-dev-request@lists.xml.org