XPath and wildcard

11 Views Asked by At

I have an XML like this:

<post>
    <Sku>191</Sku>
    <title>Some title</title>
    <description/>
    <variation_price>7.20</variation_price>
    <variation_price_1>7.40</variation_price_1>
    <variation_price_2>8.00</variation_price_2>
    <variation_price_3>8.50</variation_price_3>
    <variation_price_4>9.30</variation_price_4>
</post>

I want to write an xpath to assign the values of all variation_price* nodes to an array...

I tried various forms of $prices = $product->xpath( '//[starts-with(name, "variation_price")]' ); but I keep getting errors. What am I doing wrong?

EDIT: $product is correctly set to $xml_object->post

0

There are 0 best solutions below