Php - Xml dom function php4 and php5, Difference between XML DOM function

Xml dom function php4 and php5

The following are the difference between XML DOM functions in PHP 4 and PHP 5.

1)Create new XML document
PHP 4: domxml_new_doc('1.0');
PHP 5: new DomDocument('1.0');

2)create element
PHP 4:$doc->create_element('root');
PHP 5:$doc->createElement('root');

3)Append child
PHP 4:$doc->append_child($ch);
PHP 5:$doc->appendChild($ch);

4)Create text node
PHP 4:$doc->create_text_node($fieldvalue);
PHP 5:$doc->createTextNode($fieldvalue);

5)Set Attribute
PHP 4:$child->set_attribute('attr1', 'attrval1');
PHP 5:$child->setAttribute('attr1', 'attrval1');

6)Get completed XML document
PHP 4:$doc->dump_mem(true);
PHP 5:$doc->saveXML();

The topic on Php - Xml dom function php4 and php5 is posted by - Math

Hope you have enjoyed, Php - Xml dom function php4 and php5Thanks for your time

Tech Bluff