用户可以选择一个性能,以便性能元素具有唯一的ID。我想基本上说:简单XML - 如何选择具有特定属性值的所有元素
选择所有保留 - >预订['座位']从演出 - >表演['id = 2']。
希望这是有道理的,我真的很努力与简单的XML选择。
在此先感谢,亨利。
<performances>
<performance id="7" time="12:00" day="Monday" month="June" year="2010">
<reservations>
<reservation seat="a7"/>
<reservation seat="a2"/>
<reservation seat="a3"/>
</reservations>
</performance>
<performance id="8" time="12:00" day="Tuesday" month="June" year="2010">
<reservations>
<reservation seat="a8"/>
</reservations>
</performance>
</performances>
额外的信息:
我目前正在使用:echo $xml2->show->performances->performance['0']->reservations->reservation['seat']
这得到一个预约从第一次演出,但我想从性能上都保留有“3”例如ID 。
[SimpleXML:选择具有某个属性值的元素]的可能重复(http://stackoverflow.com/questions/992450/simplexml-selecting-elements-which-have-a-certain-attribute-value) – hakre 2013-10-26 19:50:51