in reply to Parsing xml using libXML

If you really want to roll your own like this, it would seem sensible to use recursion. You are not doing so and are in fact only going to an explicit depth in the tree at any point, hence missing the "graphics" element (and its children if there were any).

Replies are listed 'Best First'.
Re^2: Parsing xml using libXML
by shaq (Initiate) on Jul 18, 2013 at 11:37 UTC
    well I don't know how to proceed

      And why might that be? Here are some possibilities:

      1. You don't know what recursion is.
      2. You do know what recursion is, but have no idea how to do it in perl.
      3. You know what it is and how to do it, but cannot see how it applies to your problem.
      4. You've decided it would be better not to roll your own but don't know how to look for appropriate existing code.
      5. You've found some existing code but don't know how to implement it in your script.

      If you want to pick a number that would give us a bit more idea of why you are stuck and hence how you can be assisted.