You’re using DOM4J. I’m not sure what some of your code is for (you’re doing another query when you already have the report line data available) but maybe thats just because I don’t understand your data? Anyway, to iterate through your report lines I changed your code like this and it seems to work:
while (test1.hasNext()) {
TXMLObject xmlObject1 = test1.next();
Element e = (Element) xmlObject1.getElement();
List list = e.elements(tagName);
Element elem = (Element) list.get(0);
elem.node(0).getStringValue();
data = (elem.node(0).getStringValue());
System.out.println("Taxkey" + data);
elem.setText(data);
// don't use next() without checking that its really available....
TXMLObject xmlobject = xmlObject1;
System.out.println("i got xmlobject object");
Element oe = (Element) xmlobject.getElement();
List listoe = oe.elements("Collection");
int lengthList = listoe.size();
Element levy_year_elem2 = (Element) listoe.get(0);
List listrl = levy_year_elem2.elements("report_line");
int lengthrl = listrl.size();
for (int j=0;j<lengthrl;j++)
{
Element reportLine = (Element) listrl.get(j);
String report_line = reportLine.getStringValue();
System.out.println("report_line" + report_line + "J" + j);
}
System.out.print(" (");
System.out.print("ino:id=\"" + xmlobject.getId() + "\" ");
System.out.print(
"collection=\"" + xmlobject.getCollection() + "\" ");
System.out.print("doctype=\"" + xmlobject.getDoctype() + "\" ");
System.out.println(")");
}
#webMethods#API-Management#webMethods-Tamino-XML-Server-APIs