[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: XML DOM Q: understanding namespace nodes


Subject: Re: XML DOM Q: understanding namespace nodes
From: Ray Waldin <rwaldin@xxxxxxxxxxx>
Date: Thu, 16 Dec 1999 16:36:11 -0800

Mike Brown wrote:
> 
> <doc>
>    <myElement id="1" xmlns="uri0" xmlns:foo1="uri1" xmlns:foo2="uri2">
>       <bar>hello world</bar>
>    </myElement>
> </doc>
> 
> ...would have a node structure like:
> 
> |__element (expanded-name: 'doc'+nullURI)
>     |__text '\n   '
>     |__element (expanded-name: 'myElement'+'uri0')
>     |   |  |__namespace default='uri0'
>     |   |  |__namespace 'foo1'='uri1'
>     |   |  |__namespace 'foo2'='uri2'
>     |   |  |__attribute 'id'='1'
>     |   |__text '\n     '
>     |   |__element (expanded-name: 'bar'+'uri0')
>     |   |   |  |__namespace default='uri0'
>     |   |   |  |__namespace 'foo1'='uri1'
>     |   |   |  |__namespace 'foo2'='uri2'
>     |   |   |__text 'hello world'
>     |   |__text '\n  '
>     |__text '\n'
> 
> Is this correct?

Yes, except you forgot that every element has a namespace node that
corresponds to the "built-in" xml: prefix which maps to namespace uri of
"http://www.w3.org/XML/1998/namespace": 

|__element (expanded-name: 'doc'+nullURI)
    |__namespace xml='http://www.w3.org/XML/1998/namespace'
    |__text '\n   '
    |__element (expanded-name: 'myElement'+'uri0')
    |   |  |__namespace xml='http://www.w3.org/XML/1998/namespace'
    |   |  |__namespace default='uri0'
    |   |  |__namespace 'foo1'='uri1'
    |   |  |__namespace 'foo2'='uri2'
    |   |  |__attribute 'id'='1'
    |   |__text '\n     '
    |   |__element (expanded-name: 'bar'+'uri0')
    |   |   |  |__namespace xml='http://www.w3.org/XML/1998/namespace'
    |   |   |  |__namespace default='uri0'
    |   |   |  |__namespace 'foo1'='uri1'
    |   |   |  |__namespace 'foo2'='uri2'
    |   |   |__text 'hello world'
    |   |__text '\n  '
    |__text '\n'

-Ray


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread