php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #51488 Bind DOM documents to native PHP objects using Schema
Submitted: 2010-04-06 17:39 UTC Modified: 2021-08-09 13:15 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: sites at hubmed dot org Assigned: cmb (profile)
Status: Wont fix Package: DOM XML related
PHP Version: 5.3.2 OS: All
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sites at hubmed dot org
New email:
PHP Version: OS:

 

 [2010-04-06 17:39 UTC] 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');


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [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
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>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 07:01:27 2024 UTC