You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
The reader and service having slightly different signatures is definitely a bit strange in hindsight, but definitely by design. I expect most people to use the service, and the service is meant to be most user-friendly frontend for all of this.
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
, andattributes
keys.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?
The text was updated successfully, but these errors were encountered: