Closed cnkt closed 6 years ago
Sorry for the big delay. I haven't really been monitoring this as much.
Deserializers can only work on the 'content' of an element, not the element itself that's why it doesn't work on that level.
However, you are completely free in using all the apis as you see fit. For example, Sabre\Xml\Service::expect
also reads an xml document and reformats the result:
https://github.com/sabre-io/xml/blob/master/lib/Service.php#L138
So I'll just ask the obvious question... why don't you build a function that does exactly what you want?
function foo($input) {
$server = new Sabre\Xml\Service();
$result = $server->parse($input);
return [$result['name'] => $result['value'];
}
However, the expect
function might be even a bit better for your use-case.
Hey! Thanks for this great library.
I have an xml file like that:
And i'm parsing it like that:
And the result is like that:
Envelope element itself is the root and i want it to be a key-value pair too. like that: