私は次のxmlを持っています(実際にはもっと長いです)
<excluded_postcodes>
<postcode Outward="TR1">
<Inward>1DH</Inward>
<Inward>1DQ</Inward><
Inward>1DW</Inward>
<Inward>1DZ</Inward>
<Inward>1EP</Inward>
<Inward>1ET</Inward>
<Inward>1EU</Inward>
<Inward>1EX</Inward>
</postcode>
<postcode Outward="TR1">
<Inward>1PT</Inward>
<Inward>1QA</Inward>
<Inward>1QH</Inward>
<Inward>1SE</Inward>
<Inward>1SG</Inward>
</postcode>
</excluded_postcodes>
simplexml xpathsを使用して、指定された外向きの値の郵便番号をうまく照合できます
$xml->xpath('/excluded_postcodes/postcode[@Outward="TR1"]');
私がやりたいのは、postode[@Outward="TR1"] の指定された内部値の子と一致することです
$xml->xpath('/excluded_postcodes/postcode[@Outward="TR1"]/Inward//text()="1EU"');
しかし、これを達成するために正しいxpathを確立しようとしても運がありません。どんな助けでも大歓迎です。
ありがとうございました