So, you need a namespace. And this is a generic way to obtain and apply a namespace:
$doc = new DOMDocument(); $doc->loadXML( $variable0 ); $xpath = new DOMXPath($doc); $rootNamespace = $doc->lookupNamespaceUri($doc->namespaceURI); $xpath->registerNamespace('svg', $rootNamespace); $paths = @$xpath->query( "//svg:path");
Where $variable0 is the loaded SVG code. At any rate, this thing here parses PATH objects in the SVG file.
Find this interesting, or useful? Consider sharing the post.
More in category