
|
Introduction
on using PHP to create XML documents You can create XML documents using the PHP DOM. If you have worked earlier in any script or language using DOM then you can very well work with the PHP DOM too. As with other language you have to first create a new document object.
_______________________________________________
The DOM has lot of function like createElement, createTextNode etc which can be used to create an element and to create a text node for an element. Then you can use add the textnode to an element and that element to another element and so on using the appendChild function. Suppose you have create a new document object using the following command, $domobj = new DomDocument(); Then you can create an element using command like, $book
= $domobj->createElement("book"); Now to add the elements to the document object, you have to perform the following commands, $author->appendChild($authtext); Now you are free to save that XML file or print it out on the screen.
OASIS Interoperability Demo Features Eight Open Source and Commercial Implementations of OpenDocument Format (ODF) 1.2 ... Oracle lawsuit unlikely to prompt Java forking Ferrari Recalls 458 Italias After A Spate Of Fires RSS Not Parsed -- Please Refresh Page
|
| |||
|
| ||||