here's a sample of my XML file:
<agregator1 id="CSP">
<id>int</id>
<type>string</type>
</agregator1>
<agregator1 id="Microgrid">
<id>int</id>
<type>string</type>
</agregator1>
I've never worked with DOM4J and I've read the documentation but I can't seem to get the sub-elements into ArrayList's, I'm trying to do the following:
arrayList1: id, type
arrayList2: int, string
here's my code:
for ( Iterator i = root.elementIterator(); i.hasNext(); ) {
Element foo = (Element) i.next();
if(foo.attributeValue("id").toString().equals("CSP"))
{
//what am I missing here?
}
}
I've searched a lot, and I can't find any solution since I can't do foo.getChildNodes().
Any sugestions?
EDIT: I need to get the node names without using elementText(String) (or anything like this) because I need my code to work even if the XML file is changed, without editing my code.