3.5. Namespace Scoping

Namespaces have scoping rules that let you have a namespace in effect for only part of your document. A namespace declaration applies to the element where it is specified and to all elements contained within it. You can also override the binding of a prefix to a namespace URI by binding it to a different namespace URI, and you can turn off default namespace processing by setting the value of the xmlns attribute to an empty string. For example:

<root xmlns="http://www.example.com/root"> 
  <inrootnamespace/> 
  <child xmlns="http://www.example.com/child"> 
    <inchildnamespace/> 
    <nonamespace xmlns=""> 
    *    *    *    *    * 
    </nonamespace> 
  </child> 
</root> 

In the preceding example, the root and inrootnamespace elements are in the http://www.example.com/root ...

Get XML Schema Complete Reference, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.