PHP: How to get all tags inside certain tag in XML by means of DOM extension
I have XML
<myelement>
<oneelement>val1</<oneelement>
<notknown>val2</n开发者_StackOverflow社区otknown>
<notknown2>val3</notknown2>
</myelement>
and I parse it. I get one xml-tag:
$myelement=$reask->getElementsByTagName('myelement')->item(0)
Now I want get all tags inside $myelement even I don't know their names. How could I do this if I use DOM extension of PHP5?
Thanks for help.
Use the childNodes property of $myelement
as described in the manual:
$childrenOfmyelement = $myelement->childNodes;
精彩评论