I'm trying to parse an XML file in Java using the XOM library. Where i'm running into an issue is when i hit nested elements. So in XOM you start with a root node, and i am able to parse the attributes out of that root node, and the three child nodes. This isnt the XML itself but i'll lay out an example.

<root id="" name="" >
    <child1   att="" />
    <child2   att="" />
    <child3   att="" />
    <child4   att="" > -->Here is where i can't seem to parse <child4nested2> yata yata </child4nested2> 
    <child4nested2> yata yata </child4nested2> <--Up to here

So i can access all the root attributes, and i can access all the child attributes by doing Elements enteries = root.getChildElements(); It even parses this <child4 att="" > and gets the att out, but i cannot figure out how to parse the child of a child of the root element, i though it would be something like
Elements element2 = child4.getChildElements(); but that returns a null pointer.
Any help would be great

4 Years
Discussion Span
Last Post by ~s.o.s~

You need to post the entire self-contained code which can be used to re-produce the issue. I really see no reason why nested elements wouldn't work.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.