
- You are not logged in. | Login
January 16, 2007 9:52 am
- selmahyekishot
- Member


Problems with DOM functions. Please help
Hi
I’ve installed apache2 + php5 + mysql.
It required DOM functions for working with xml. I’ve uncommented it to the php.ini string with php_domxml extension.
When i started using examples from the php.net it shows:
Call to a member function append_child() on a non-object
Example of the code:
$doc = domxml_new_doc("1.0");
$root = $doc->create_element("HTML");
$root = $doc->append_child($root);
$head = $doc->create_element("HEAD");
$head = $root->append_child($head);
$title = $doc->create_element("TITLE");
$title = $head->append_child($title);
$text = $doc->create_text_node("This is the title");
$text = $title->append_child($text);
$doc->dump_file("/tmp/test.xml", false, true);
Also tried that variant:
$dom = new DOMdocument('1.0');
$element = $dom->create_element('test', 'This is the root element!');
$dom->append_child($element);
echo $dom->dump_mem(true);
$dom->dump_file("/tmp/test.xml", false, true);
In that case there are no any mistakes and xml file too. Could you help me please?
January 16, 2007 9:53 am
- phppat
- Member


Re: Problems with DOM functions. Please help
Try to use as follows:
$dom = new DOMdocument('1.0', 'iso-8859-1');
$xsl = new DOMdocument;
$xsl->load('2.xsl');
$list_of_teams = $dom->createElement('rows');
$dom->appendChild($list_of_teams);
$team = $dom->createElement('heder');
$list_of_teams->appendChild($team);
PHP monster


