php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53693 transformToDoc, different class
Submitted: 2011-01-08 05:31 UTC Modified: -
Votes:4
Avg. Score:4.0 ± 1.7
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: mat at homedvd dot ca Assigned:
Status: Open Package: XSLT related
PHP Version: Irrelevant OS: Any
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-01-08 05:31 UTC] mat at homedvd dot ca
Description:
------------
It would be very helpful to allow transformToDoc to return a custom class instance, which would have to extend DOMDocument of course.

The example code provided is simplified.  Far better usage could be made from the child DOMDocument class -- this is only an example to illustrate the potential.

Test script:
---------------
class DOMDocumentYouCanFancyPrint extends DOMDocument {
    public function __toString() {
        return "<pre>" . htmlentities( $this->saveXML() ) . "</pre>";
    }
}

...

$processor->registerDocumentClass( "DOMDocumentYouCanFancyPrint" );
echo $processor->transformToDoc( $sourceDOM );

Expected result:
----------------
The expected result would be that the transformToDoc method call returns an instance of DOMDocumentYouCanFancyPrint.


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Nov 19 00:01:39 2019 UTC