How can I check with the DOM-API, if a tag is empty (<mytag/>) or not (<mytag>data</mytag>)?

Davanum Srinivas

Element element = ....;
String  nodeValue = element.getNodeValue();
if(nodeValue==null||nodeValue.length()==0)
    System.out.println("Element is empty");
else
    System.out.println("Element value:" + nodeValue);
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact