[jdom-interest] Namespace redeclaration

Peter.Horvath at smed.com Peter.Horvath at smed.com
Thu Jun 14 08:03:10 PDT 2001


Hi, in my prvious mail I had a question about a name space redeclaration.

I found the answare and JDOM works correctly.

For those who are interested in the answare I cut & paste a part form a
namespace FAQ (http://www.rpbourret.com/xml/NamespacesFAQ.htm).


4.7) How do I undeclare an XML namespace prefix?


You cannot "undeclare" an XML namespace prefix. It remains in scope until
the end of the element on which it was declared unless it is overridden.
Trying to undeclare a prefix by redeclaring it with an empty (zero-length)
name (URI) results in an error. For example:


  <foo:A xmlns:foo="http://www.foo.org/">
     <foo:B>
        <foo:C xmlns:foo="">   <==== This is an error.
           <foo:D>abcd</foo:D>
        </foo:C>
     </foo:B>
  </foo:A>

4.8) How do I undeclare the default XML namespace?


To "undeclare" the default XML namespace, you declare a default XML
namespace with an empty (zero-length) name (URI). Within the scope of this
declaration, unprefixed element type and attribute names do not belong to
any XML namespace. For example, in the following, the default XML namespace
is the http://www.foo.org/ for the A and B elements and there is no default
XML namespace for the C and D elements. That is, the names A and B are in
the http://www.foo.org/ namespace and the names C and D are not in any XML
namespace.


  <A xmlns="http://www.foo.org/">
     <B>
        <C xmlns="">
           <D>abcd</D>
        </C>
     </B>
  </A>




-------------------------------------------------------------------------------
This message and any included attachments are from Siemens Medical Solutions 
Health Services Corporation and are intended only for the addressee(s).  
The information contained herein may include trade secrets or privileged or 
otherwise confidential information.  Unauthorized review, forwarding, printing, 
copying, distributing, or using such information is strictly prohibited and may 
be unlawful.  If you received this message in error, or have reason to believe 
you are not authorized to receive it, please promptly delete this message and 
notify the sender by e-mail with a copy to CSOffice at smed.com.  Thank you



More information about the jdom-interest mailing list