4.4 Node Types

node()

any node of any type



/

root



*

any element node



@*

any attribute node



text()

any text node



comment()

 



processing-instruction()

 

processing-instruction(’target’)

 

<article title="red"  
         canvas="yellow">  
  <section>  
    <title>First  
       section</title>  
    <sentence>Some  
       text.</sentence>  
    <sentence>More  
       text.</sentence>  
    <!--comment-->  
    <?pi a?>  
    <?pia b?>  
  </section>  
  <ns:appendix xmlns:ns="none"/>  
</article>

//*/text() First section
Some text.
More text.


//comment() comment


//processing-instruction() a
b


//processing-instruction(’pi’)b


//node()/*/@*  

The test program can be employed for the above examples (it requires java 5.0)