PHP uses the DOMDocument class to generate HTML instances (including common tag elements ). In this section, we will learn how to use core PHP to generate HTML files. recently, when I was querying php.net, I found the DOMDocument class very
When using
The XML file used is also an example of XML in the article "How to use PHP XML to Process SimpleXML", the file name is: Me.xml. The code is as follows:
PHP XML processing XML code
? xml version = "1.0" encoding="utf-8"?>
Create a DOMDocument object using DOM extension, add elements to the document using the DOMDocument object method, and generate the document using the save () or saveXML () method, you can also use SimpleXML to quickly solve the problem... create a
A total of four files, respectively, is to create, add, delete, modify four functions, variables are written dead, change to a $_post way to receive it can be used
index.php Creating features
Copy CodeThe code is as follows:
$xmlpatch = '
Set of common phpxml functions (more detailed ). 1. Functions of DOM a and DOMDocument-load (): loads xml files. usage: DOMDocument-load (stringfilename) parameter: filename, xml file; return: TRUE if successful, error
1. DOM functions
A.
1. DOM functions
A, Domdocument->load ()
Role: Loading an XML file
Usage: domdocument->load (string filename)
Parameters: Filename,xml file;
Returns: TRUE if successful, or FALSE if unsuccessful.
B, Domdocument->loadxml ()
Role: Loading XML
New XML features of PHP5. Target Readers: This article is intended for PHP developers who are interested in the new XML functions of PHP5. We assume that the reader has basic knowledge about XML. However, if you are already targeting readers
This
http://trash.chregu.tv/phpconf2003/examples/
New XML features of PHP5
Author Christian Stocker Translator Ice_berg16 (The Scarecrow looking for a dream)
For the reader
This article is targeted at all levels of PHP developers interested in PHP5 's
SaveXML () function: Place an internal XML document into a string; for Example: "Test.xml" Tovejanireminderdon ' t forget me this weekend! $xmlDoc =new DOMDocument (); $xmlDoc->load ("Test.xml");p rint $xmlDoc->savexml (); Output:tove Jani Reminder
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.