• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
XML Helper - generate XML quickly and easily

#1
[eluser]Jérôme Jaglale[/eluser]
Download and documentation

New XML document
Code:
$dom = xml_dom();

Add "book" element
Code:
$book = xml_add_child($dom, 'book');

Add "title" to "book"
Code:
xml_add_child($book, 'title', 'Hyperion');

Add "author" to "book"
Code:
$author = xml_add_child($book, 'author', 'Dan Simmons');

Add "birthdate" attribute to "author"
Code:
xml_add_attribute($author, 'birthdate', '1948-04-04');

Display XML document
Code:
xml_print($dom);


Output
Code:
<?xml version="1.0"?>
<book>
  &lt;title&gt;Hyperion&lt;/title&gt;
  <author birthdate="1948-04-04">Dan Simmons</author>
</book>

PHP 5 required. Based on DOMDocument.


Messages In This Thread
XML Helper - generate XML quickly and easily - by El Forum - 03-23-2009, 04:37 PM
XML Helper - generate XML quickly and easily - by El Forum - 03-24-2009, 03:17 AM
XML Helper - generate XML quickly and easily - by El Forum - 01-07-2010, 08:25 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.