private static
String getSubItemName(Element elementpara, String tagName)
{
NodeList nodelist = null;
Element element = null;
NodeList oNodelist = null;
String returnStr = null;
nodelist = elementpara.getElementsByTagName(tagName);
element = (Element) nodelist.item(0);
oNodelist = element.getChildNodes();
NodeList nlist = elementpara.getElementsByTagName("HomogeneousMaterial");
System.out.println("nlist====" + nlist.getLength());
Element e1 =(Element)nlist.item(0);
String str = e1.getAttribute("name");
System.out.println("STR====" + str);
String sSubName = element.getAttribute("name");
System.out.println("sSubName====" + sSubName);
return returnStr;
}
public static void readingData(String fileName) throws Exception {
try{
initialize(fileName);
NodeList dbTag = doc.getElementsByTagName("MCD");
int detailLength = dbTag.getLength();
for (int j=0;j<detailLength;j++) {
Node firstDBTagNode = dbTag.item(j);
if (firstDBTagNode.getNodeType() == Node.ELEMENT_NODE){
Element firstDBTagElement = (Element) firstDBTagNode;
String str11 = getSubItemName(firstDBTagElement,"SubItem");
}
}
}catch(IOException io) {
System.out.println("====Exception===" + io.getMessage());
}
}
no fishing, got struck in the above method..
rgds
Rajesh