[
Lists Home |
Date Index |
Thread Index
]
- From: David Megginson <david@megginson.com>
- To: "XML Developers' List" <xml-dev@ic.ac.uk>
- Date: Mon, 8 Feb 1999 10:40:44 -0500 (EST)
[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@megginson.com
http://www.megginson.com/
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
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@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)
|