开发者

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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜