Using sabre with XSD validation I'm getting unexpected result when using the XSD snippet from documentation.
There's actually 2 problems with suggested solution:
$service = new Sabre\Xml\Service(); $reader = $service->getReader(); $validXml = $reader->setSchema('myschema.xsd') if ($validXml) { $reader->xml($xml); print_r($reader->parse()); }
will not work as the Schema needs to be set after xml() method call.
Additionally the parse() method is returning root element array with name, value, and attributes keys.
Looking at code this happens because Service::parse() is returning $result['value'] while Reader::parse() is returning $result.
Can you please either correct the code, to always have same result, or at least update the documentation to make it clear what to expect?
Using sabre with XSD validation I'm getting unexpected result when using the XSD snippet from documentation.
There's actually 2 problems with suggested solution:
$service = new Sabre\Xml\Service(); $reader = $service->getReader(); $validXml = $reader->setSchema('myschema.xsd') if ($validXml) { $reader->xml($xml); print_r($reader->parse()); }will not work as the Schema needs to be set after
xml()method call.Additionally the
parse()method is returning root element array withname,value, andattributeskeys.Looking at code this happens because
Service::parse()is returning$result['value']whileReader::parse()is returning$result.Can you please either correct the code, to always have same result, or at least update the documentation to make it clear what to expect?