i am parsing a xml file and i am able to get the certain values but for some element i.e li is not returning the value,please have a look on these file
xml:
<DRM>
<pages>
<page id= 1>
<print>
<wholepage >N </wholepage>
<li>
<id>p001_001</id>
<id>p002_003</id>
</li>
</print>
<copy>
<wholepage >N </wholepage>
<li>
<id>p001_002</id>
<id>p002_003<id>
</li>
</copy>
</pages>
<page id = 2>
<print>
<wholepage>Y</wholepage>
</print>
<copy>
<wholepage>Y</wholepage>
</copy>
</page>
</page>
</pages>
</DRM>
parser :
XMLParser parser = new XMLParser();
String data=c1.decrypt(baseurl+"/Metadata/Metadata1.xml");
System.out.println(data);
Document doc = parser.getDomElement(data);
NodeList n=doc.getElementsByTagName("pages");
Element e = (Element) n.item(0);
NodeList nl_li_l2=e.getElementsByTagName("page");
for(int i=0;i<nl_li_l2.getLength();i++)
{
Element e_1 = (Element) nl_li_l2.item(i);
String val= e_1.getAttribute("id");
System.out.println("val:"+val);
NodeList print_list=e_1.getElementsByTagName("print");
for(int j=0;j<print_list.getLength();j++)
{
Element e_2 = (Element)print_list.item(j);
String wp= parser.getValue(e_2,"wholepage");
System.out.println("p whole page:"+wp);
NodeList print_li=e_2.getElementsByTagName("li");
for(int h=0;h<print_li.getLength();h++)
{
Element e_4 = (Element)print_li.item(h);
NodeList print_i=e_4.getElementsByTagName("id");
for(int h1=0;h1<print_i.getLength();h1++)
{
Element e_5 = (Element)print_i.item(h1);
String wp1= parser.getValue(e_5,"id");
System.out.println("wp1"+wp1);
}
}
}
NodeList copy_list=e_1.getElementsByTagName("copy");
for(int j=0;j<copy_list.getLength();j++)
{
Element e_5 = (Element) copy_list.item(j);
String cp= parser.getValue(e_5,"wholepage");
System.out.println(" c whole page:"+cp);
NodeList copy_li=e_5.getElementsByTagName("li");
for(int h=0;h<copy_li.getLength();h++)
{
Element e_6 = (Element)copy_li.item(h);
NodeList copy_id=e_6.getElementsByTagName("id");
for(int h1=0;h1<copy_id.getLength();h1++)
{
Element e_id = (Element)copy_id.item(h1);
String cc= parser.getValue(e_id,"id");
System.out.println("cp1"+cc);
}
}
}
}
but here i am not able to get the value inside li tag in xml.Loop is running perfectly but value is null,please help me to find out where the exact problem is?