[
Lists Home |
Date Index |
Thread Index
]
- From: Richard Tobin <richard@cogsci.ed.ac.uk>
- To: xml-dev@lists.xml.org
- Date: Mon, 09 Oct 2000 12:34:15 +0100 (BST)
Amy Lewis <amyzing@talsever.com> wrote:
>Obfuscated xml.
Apart from the lengthy URIs, not very.
>Tidy refuses to see any errors in it,
There aren't any namespace errors in it. (There are two syntax errors in
the XML declaration and an unescaped ampersand in one of the URIs.)
>I'm not even quite sure what namespace the
>most internal foo:element and foo:attribute are in (I think that the
>most internal element is in a different namespace than the attribute
>that it contains, but I'd hate to swear to it).
That's never the case. If an element and one of its attributes have
the same prefix, they must be in the same namespace, since they have
the same namespace bindings in scope.
>What I'd
>like to know, then, is: what is the use case for giving namespace
>declarations scope?
An important reason is to allow you to combine XML documents. Suppose
you want to include someone else's XML inside one of your elements.
If namespaces weren't scoped, you'd have to check through the included
text and change any prefixes that happened to clash with your own.
You can check namespace correctness with my XML checker:
http://www.cogsci.ed.ac.uk/~richard/xml-check.html
If you want to check which namespace an element or attribute is in,
get RXP:
http://www.cogsci.ed.ac.uk/~richard/rxp.html
and use the -N and -b flags, eg
rxp -Nb foo.xml
-- Richard
|