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