|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-08-09 13:15 UTC] cmb@php.net
-Status: Open
+Status: Wont fix
-Assigned To:
+Assigned To: cmb
[2021-08-09 13:15 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 16:00:02 2025 UTC |
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');