[PHPwestoz] Generating XML, for DOM work in JS

Timothy White weirdo at tigris.org
Tue Mar 14 16:19:02 UTC 2006


I'm looking at generating XML via PHP, so that I can get it with a JS
'ajax' call, and then append a node from the XML DOM tree, into the
Document DOM tree.

Currently I'm trying to generate the XML with the following[1] but
when I get the DOM Node, and Append it via JS to the XHTML doc, it
doesn't appear to have the correct element types, instead of things
like HTMLParagraphElement it's just a Element :(

Any ideas?

Thanks

Tim

[1]
<?php
header("Content-type: text/xml");
$doc = domxml_new_doc("1.0");
/* The following line does not appear to make a difference ether way */
$doc->set_namespace('http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd');

$root = $doc->create_element("P");
$root = $doc->append_child($root);
$br = $doc->create_element("BR");
$text = $doc->create_text_node("This is the test text");
$text = $root->append_child($text);
$root->append_child($br);
echo $doc->dump_mem();
?>
--
Linux Counter user #273956




More information about the PHPwestoz mailing list