HOWTO: HTML_Quickform and XML
| From: | Ian P. Christian | Date: | Mon, 14 Jun 2004 08:35:55 +0000 |
| Subject: | HOWTO: HTML_Quickform and XML | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-13139@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
A real quick tip for those trying to use HTML_Quickform in XML environments.
Previously I submitted an XML renderer, but I have found a better way.
This method relies on HTML_Quickform outputting valid XHTML, and if it
doesn't, things *will* go badly wrong, but if this happens, HTML_QuickForm
should be corrected. This is partially a quick and dirty hack, and a XML
renderer (like mine previously submitted) would be preferable. (probably,
I've not run any form of profiling to support this assumption).
Example of how to convert an HTML_QuickForm into DOMXML.
$form =& new HTML_QuickForm('moo');
$form->addElement('header', null, 'This is a test!');
$form->addElement('text', 'Name', 'Name');
$dom = domxml_open_mem($form->toHTML());
$root = $dom->document_element();
$html = $root->clone_node(true);
The form can now be appended into an existing XML document:
$existing_dom_document->append_child($html);
and can be transformed using XSL.
I hope this is of help to someone.
Kind Regards,
Ian P. Christian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFAzWNrEe6ncNCcEO0RAkOIAJ92fYsr9Se/u+TlqeN3+cL84vf5ngCfR1qe
HCSfwrkyXbzp+4f1Lf845Qw=
=BDCi
-----END PGP SIGNATURE-----