У меня есть файл XML-листа. Узлы похожи на этот: `
<StockID>26868</StockID>
<LatinName>'The Garland' AGM</LatinName>
<CommonName>Rose</CommonName>
<DetailedDescription>A vigorous spreading climber. Masses of small semi-double creamy-white tinted pink daisy like flws. Very fragrant. Ht 15ft x 10ft. Lovely growing through trees or shrubs. Shade tolerant. Very hardy.</DetailedDescription>
<SalePriceIncVAT>19.99</SalePriceIncVAT>
<VATValue>20</VATValue>
<SalePrice>16.6583</SalePrice>
<QuantityAvailable>3</QuantityAvailable>
<GroupDescription>Roses</GroupDescription>
<GenusDescription>Rosa</GenusDescription>
<PotSize>4</PotSize>
<Locations>
<Location>
<Description>Nursery</Description>
<Quantity>3</Quantity>
</Location>
</Locations>
<Classifications>
<Classification>
<Description>Soil Type</Description>
<Value>Any reasonable soil</Value>
</Classification>
</Classifications>
`
Я обрабатываю файл с помощью PHP
$_product = wc_get_product($id);
if($_product){ // check if it's got a product
$sku = $_product->get_sku();
$nodes = $xml->xpath('//StockDetails/StockDetail/StockID[.="'.$sku.'"]/parent::*');
$result = $nodes[0];
if(isset($result)){
Работает довольно хорошо, но, к сожалению, это большой файл. Содержит ~ 8000 узлов.
Проблема в том, что по какой-то причине ему не хватает ~ 200 узлов.
Я предполагаю, что моя строка Xpath неверна.
Может кто-нибудь привести меня к решению?