Access attribute values of empty element tag in xml
        Posted  
        
            by meenakshik
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by meenakshik
        
        
        
        Published on 2010-04-22T10:29:04Z
        Indexed on 
            2010/04/22
            10:33 UTC
        
        
        Read the original article
        Hit count: 194
        
Hello,
I have a xml where I got some empty complex elements and I need to access the attribute values of this element.
<test>
  <a>
<abc-metadata name="testData" value="This is a test"/>
  </a>
</test>
I want to get hold of the 'testData' and 'This is a test' values.
I do read the document and I tried accessing it document.getElementsByTagName . I am sure there is some way to access attributes of element tags but somehow it throws me nullpointer exception.
Thanks in advance
© Stack Overflow or respective owner