Req #51488 [Opn->Wfx]: Bind DOM documents to native PHP objects using Schema

From: Date: Mon, 09 Aug 2021 13:15:39 +0000
Subject: Req #51488 [Opn->Wfx]: Bind DOM documents to native PHP objects using Schema
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235707@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=51488&edit=1 ID: 51488 Updated by: cmb@php.net Reported by: sites at hubmed dot org Summary: Bind DOM documents to native PHP objects using Schema -Status: Open +Status: Wont fix Type: Feature/Change Request Package: DOM XML related Operating System: All PHP Version: 5.3.2 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Given that this ticket had neither feedback nor upvotes for more than ten years, I'm closing as WONTFIX. Anybody who is still interested in this, please pursue the RFC process[1]. [1] <https://wiki.php.net/rfc/howto> Previous Comments: ------------------------------------------------------------------------ [2010-04-06 17:39:32] sites at hubmed dot org 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 this bug report at https://bugs.php.net/bug.php?id=51488&edit=1

« previous php.bugs (#235707) next »