1

I'm trying, to filter out all SimpleXMLElement Objects, which contain the value "fds".

$xmlDocument = file_get_contents($Url, false, $context);
$xmlString = simplexml_load_string($xmlDocument);
$root = $xmlString->xpath("//fds");
print_r($root);

Sadly it returns a empty array, am I doing something wrong with the xpath?

What im exactly trying to do: Filter out each object, which contains: /fds/creations/

dane
  • 25
  • 2

1 Answers1

0

To filter an value you have to define the Element and the attribute.

//Element[@attribute1="abc"]

you specify the attribute in braces.

René Höhle
  • 26,716
  • 22
  • 73
  • 82
  • Lets say this is the XML: http://testing.zwiink.us/getPurchased.php So incase i want to filter out each item which contains /zwinky/fds/creations/ i would need to create a foreach loop. to run through all the items and use an xpath element to filter them out? – dane Nov 08 '14 at 18:05