【发布时间】:2016-08-06 10:06:01
【问题描述】:
我有一个如下的 XML:
<xml>
<grandparent>
<parent>
<father>A</father>
<mother>B</mother>
<children>
<name>C</name>
<name>D</name>
</children>
</parent>
<parent>
<father>E</father>
<mother>F</mother>
<children>
<name>G</name>
<name>H</name>
<name>I</name>
</children>
</parent>
<parent>
<father>J</father>
<mother>K</mother>
<children>
<name>L</name>
</children>
</parent>
</grandparent>
</xml>
我如何在这个 XML 中循环并检索父名称和子名称。
我必须得到以下结果: 第 1 行:A、B、C、D
第 2 行:E、F、G、H、I
第 3 行:J、K、L
请帮忙。 谢谢。
【问题讨论】:
标签: javascript xml loops nested