[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

[corrected] 19 Short Questions about Namespaces (with Answers)

  • From: David Megginson <david@m...>
  • To: "XML Developers' List" <xml-dev@i...>
  • Date: Mon, 8 Feb 1999 10:40:44 -0500 (EST)

short questions
[The inevitable typo showed up -- thanks to Adam Donahue and John
Simpson for pointing it out, and even just for reading far enough to
find it.]

	  19 SHORT QUESTIONS ABOUT NAMESPACES (WITH ANSWERS)

				  by

			   David Megginson



		     Monday 8 February 1999 (v.2)



BACKGROUND
----------

For the full specification of XML 1.0, see [1]; for the full
specification of Namespaces in XML, see [2].

This brief review uses James Clark's notation for writing names that
contain both a URI part and a local part.  For example, if the URI
part of a name were "http://www.foo.com/" and the local part were "a",
the name would be written

  {http://www.foo.com/}a

This is purely a convenience notation for the sake of documentation;
it is not defined by any known specification, and is unlikely to be
recognised by any processor.



CHAPTER ONE: The XML 1.0 Perspective
------------------------------------

[Example]

  <a b="x" c="y"/>

[Q] What is the name of the element in the example above?
[A] The name is "a".

[Q] What is the name of the first attribute in the example above?
[A] The name is "b".

[Q] What is the name of the second attribute in the example above?
[A] The name is "c".

[Q] What do the names mean?
[A] The application determines the meaning of the names.

[Q] How do you write a DTD declaration describing the structure of
    this element?
[A] <!ELEMENT a EMPTY>
    <!ATTLIST a 
      b CDATA #IMPLIED 
      c CDATA #IMPLIED>



CHAPTER TWO. The Namespaces Perspective
---------------------------------------

[Example 2a]

  <z:a z:b="x" c="y" xmlns:z="http://www.foo.com/"/>

[Q] What is the name of the element in the example above?
[A] The name is "z:a" from the XML 1.0 perspective, or
    "{http://www.foo.com/}a" from the Namespaces perspective.

[Q] What is the name of the first attribute in the example above?
[A] The name is "z:b" from the XML 1.0 perspective, or
    "{http://www.foo.com/}b" from the Namespaces perspective.

[Q] What is the name of the second attribute in the example above?
[A] The name is "c" from both the XML 1.0 and the Namespaces
    perspectives.

[Q] What is the name of the third attribute in the example above?
[A] The name is "xmlns:z" from the XML 1.0 perspective; from the
    Namespaces perspective, this attribute is a declaration.

[Q] What do the names mean?
[A] The application determines the meaning of the names.

[Q] What does the namespace URI "http://www.foo.com/" mean?
[A] It has no defined meaning.

[Q] How do you write a DTD declaration describing the structure of
    this element?
[A] DTDs use the XML 1.0 perspective:
    <!ELEMENT z:a EMPTY>
    <!ATTLIST z:a 
      z:b CDATA #IMPLIED 
      c CDATA #IMPLIED
      xmlns:z CDATA #FIXED "http://www.foo.com">



[Example 2b]

  <a b="x" c="y" xmlns="http://www.foo.com/"/>

[Q] What is the name of the element in the example above?
[A] The name is "a" from the XML 1.0 perspective, or
    {http://www.foo.com/}a from the Namespaces perspective.

[Q] What is the name of the first attribute in the example above?
[A] The name is "b" from both the XML 1.0 and the Namespaces
    perspectives.

[Q] What is the name of the second attribute in the example above?
[A] The name is "c" from both the XML 1.0 and the Namespaces
    perspectives.

[Q] What is the name of the third attribute in the example above?
[A] The name is "xmlns" from the XML 1.0 perspective; from the
    Namespaces perspective, this attribute is a declaration.

[Q] What do the names mean?
[A] The application determines the meaning of the names.

[Q] What does the namespace URI "http://www.foo.com/" mean?
[A] It has no defined meaning.

[Q] How do you write a DTD declaration describing the structure of
    this element?
[A] DTDs use the XML 1.0 perspective:
    <!ELEMENT a EMPTY>
    <!ATTLIST a 
      b CDATA #IMPLIED 
      c CDATA #IMPLIED
      xmlns CDATA #FIXED "http://www.foo.com">


REFERENCES
----------

[1] http://www.w3.org/TR/REC-xml
[2] http://www.w3.org/TR/REC-xml-names



All the best,


David

-- 
David Megginson                 david@m...
           http://www.megginson.com/

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.