|
|
Difference between XML DOM functions in PHP 4 and PHP 5 - PHP
|
Views : 751
|
|
Tagged in : PHP
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
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($s);
PHP 5:$doc->appendChild($s);
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();
|
|
By - Rekha, On - 2009-12-09 |
|
|
|