$this->layer_paths = $this->svg->xpath( '//svg:g[starts-with(@inkscape:label, "Paths")]'
// где-то в другом месте:
foreach ($this->layer_paths as $path) {
$path_d = (string)$path->attributes()->{'d'};
}
$path
это SimpleXMLElement или что $this->layer_paths
является массивом, содержащим такие элементы? $all_paths_at_layer = $svg->xpath('//svg:g[starts-with(@inkscape:label, "Paths")]/svg:path');
foreach ($all_paths_at_layer as $path) {
$path_d = (string)$path->attributes()->{'d'};
$path_id = (string)$path->attributes()->{'id'};
$path_style = (string)$path->attributes()->{'style'};
}
public function parse($paths_layers_name , $images_layer_name)
{
$this->layer_paths = $this->svg->xpath( '//svg:g[starts-with(@inkscape:label, "Paths")]' );
$this->layer_images = $this->svg->xpath( '//svg:g[starts-with(@inkscape:label, "Images")]/svg:image' );
}
public function getPathsDefinition()
{
foreach ($this->layer_paths as $path) {
$path_d = (string)$path->attributes()->{'d'};
$path_id = (string)$path->attributes()->{'id'};
$path_style = (string)$path->attributes()->{'style'};
...
}
}