Use DOM to control XML in PHP5, read and use DOM to control XML in PHP5, enhance XML support in PHP5, and extend XML operation capability using DOM. These functions are part of the PHP5 core and can be used without installation. The following
What is this in php? what is this first time? how do I obtain the value ??? Thanks for the data sent from the taobao system. I want to take the value and store it in the database. How can I get the title, num, and share it with php? what is this,
PHP can easily generate and read XML files. PHP mainly reads and writes XML through DOMDocument, DOMElement, and DOMNodeList. The following describes how to use these classes. 1. generate an XML file for the following XML file. [Html] & lt ;?
This data came from the Taobao system, and I'm going to take the value and deposit it into the database.
How do I get to Title,num
Reply to discussion (solution)
I don't know ...Seemingly multi-dimensional array ...
Echo {xx[items]->item}[0]
Have to write one yourself. The operation of XML has never been used. Here are the XML operation classes that you have collected
DOMDocument related content.
Property:
Attributes---> Storage node Property list (read-only)
ChildNodes List of
PHP reads and writes XML files. PHP can easily generate and read XML files. PHP mainly reads and writes XML through DOMDocument, DOMElement, and DOMNodeList. The following describes how to use PHP to easily generate and read XML files. PHP mainly
The XML support is enhanced in PHP5, and the XML operation capability is extended using DOM. These functions are part of the PHP5 core and can be used without installation. The following example demonstrates DOM operations on XML. For more
Domdocument-related content.
Attribute:
Attribute list of the attributes storage node (read-only)List of child nodes of the childnodes storage node (read-only)Datatype returns the Data Type of this nodeDefinition defines nodes in DTD or XML
Copy codeThe Code is as follows:/*
-->
]/> -->
Sun Wukong
sun Walker
123
White Bone essence 140 introduction */$ Xmldoc = new DOMDocument ('1. 0', 'utf-8 ');$ Xmldoc-> load ('datas. xml ');
$ ItemsNodeList = $ xmldoc->
Main functions: Use the DOM class in php to read XML files
Design knowledge point:
1. XML node circular reading
2. Use the iconv () function to implement encoding conversion to prevent Chinese garbled characters
The holiday. xml file is as
Two questions:
First question:
XMLHTTP responsetext default is always utf-8 encoding, in order to solve the problem with the minimum cost, simply the whole project with UTF-8 code. Online solutions are not many, and are relatively messy, do not like.
Main function: Use DOM class to read XML file in PHP
Design Knowledge Points:
1, XML node loop read
2, using Iconv () function to achieve code conversion to prevent Chinese garbled
Holiday.xml files are as follows
Copy Code code as follows:
The following example simply demonstrates the DOM's operations on XML, explaining in detail the comments in the code
Copy Code code as follows:
?
/************************************************
* * Use XML in PHP5
* * Reference
The example code in the sixth chapter today is not working. Prompt for objects that are not referenced.Append Code Snippetprivate void Refreshearthquakes () {Get the XMLURL url;try {String quakefeed = getString (r.string.quake_feed);url = new URL
There are two main ways to parse XML, one is DOM, and one is sax.The 1.dom method is to put the XML data into memory as an object in a tree-like structure.(1) Advantages: Convenient for the data in the XML and other changes, is the recommended way
CopyCode The Code is as follows: array. Prototype. inarray = function (value ){
VaR I;
For (I = 0; I If (this [I] === value ){
Return true;
}
}
Return false;
};
function addevent (OBJ, type, FN) { If (obj. addeventlistener) { obj.
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.