how do i get the list of children in xml->request->ABC
ABC may have DEF, ZZA, XAS, ETC and i would like to iterate through a list of these children (name required) instead of checking if they exist.
-edit-
Note: I am looking for the element name. I found an example which returns an attribute IF its known. How do i get the tag/element name?
Considering this piece of XML and the code to load it with SimpleXML :
What about using the
children()method to get the list of all children of you ABC element, and loop over them with a foreach ?This way, for instance :
And you’ll get this kind of output :