Updating xml files with php
IO namespace and various other XML classes included in the System. Listing 1 shows a simple XML file for demonstration: To test the above XML file for errors, simply open it with your browser.
If it has no errors, the file will be displayed as such.
After the XMLDOM Object has been instantiated, the structure of the XML must be laid out by creating object references to the elements that make up each layer of the XML document.
The following is an example of how the XMLDOM would be instantiated and a reference to the root element created.
Writing a form submission to an XML document just becomes a matter of iterating through the Request Object's Form Collection and writing the value of each form field to an XML element value. Below is a normal HTML form that we will be using for this example.
This form asks for the user's name, address, telephone number, and e-mail address.
If you use this code in your own applications, remember one thing, when the "Convert Formto XML" Function runs, if the XML file name specified already exists, it will be overwritten.Value = "005";// Attach the attribute to the XML elementnewcatalogentry.Set Attribute Node(newcatalogattr);// First Element - Book - Created Xml Element firstelement = xmldoc.The XML file that would be produced by this example would appear (something similar to) as follows: I would suggest copying the code for Enter and process to pages of the same name on your Web server and running the example.Make sure that you use a path and file name that work for your server.