From: Operating system: All PHP version: 5.3.2 Package: DOM XML related Bug Type: Feature/Change Request Bug description:Bind DOM documents to native PHP objects using Schema
Description: ------------ Somewhere within the SoapClient and libxml code are functions that a) parse an XSD schema into a set of data types (available through SoapClient::__gettypes), and b) apply that schema to an XML document to produce a native PHP object. Would it be possible to make these functions available to all DOMDocument objects, so that an XML document returned from a non-SOAP web service can be bound - using the schema - to a native PHP object? (related, existing functions include xmlrpc_decode, wddx_unserialize, XSLTProcessor::transformToDoc and DOMDocument::schemaValidate) Test script: --------------- // load the XSD Schema $dom = new DOMDocument; $dom->load('example.xsd'); // import the schema to a SchemaBinder class, similar to XSLTProcessor::importStylesheet $binder = new SchemaBinder; $binder->importSchema($dom); // load the XML document $dom = new DOMDocument; $dom->load('example.xml'); // bind the XML document to a native PHP object, using the schema $data = $binder->bind($dom); =========================== /* or more simply */ $data = $dom->bindFromSchema('example.xsd'); -- Edit bug report at http://bugs.php.net/bug.php?id=51488&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51488&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51488&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51488&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51488&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51488&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51488&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51488&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51488&r=needscript Try newer version: http://bugs.php.net/fix.php?id=51488&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51488&r=support Expected behavior: http://bugs.php.net/fix.php?id=51488&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51488&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51488&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51488&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51488&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=51488&r=dst IIS Stability: http://bugs.php.net/fix.php?id=51488&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51488&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51488&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51488&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51488&r=mysqlcfg