[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Namespaces and other stuff
In the example you quote, the part xmlns:html="... 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" xmlns:html="any-old-bollocks"> <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> </article> 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": <article> <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> </article> 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 http://www.alphaxml.com -----Original Message----- From: Guillermo J. HOYOS RIVERA [mailto:ghoyos@l...] Sent: 14 May 2001 17:41 To: 'xml-dev@l...' Cc: Guillermo de Jesús HOYOS RIVERA Subject: Namespaces and other stuff Hello: 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" xmlns:html="any-old-bollocks"> 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 <http://www.oasis-open.org> 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@l...
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|