用戶可以選擇一個性能,以便性能元素具有唯一的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