A number of SmipleXML functions are available for loading and parsing large XML documents.
-------------------------------------------------- ----------------------------------
1.simpleXML_load_file() Function to load the specified XML file into the object. Returns FLASE if there is a problem loading the file. Example:
book.xml file:
Copy code The code is as follows:
Pride and Prejudice
Jane Austen
Jane Austen's most popular work.
The Conformist title>
Alberto Moravia
Alberto Moravia's classic psyhcological novel.
The Sun Also Rises
Ernest Hemingway
The masterpiece that launched Hemingway's career.
php file:
Copy code The code is as follows:
$xml=simplexml_load_file("book.xml");echo "
";
var_dump($ xml);
?>
Output result:
Copy code The code is as follows:
object(SimpleXMLElement)#1 (1) {
["book"]=>
array(3) {
[0]=>
object(SimpleXMLElement)#2 (3) {
["title"]=>
string(19) "Pride and Prejudice"
["author"]=>
string(11) "Jane Austen"
["description"]=>
string(32) "Jane Austen's most popular work."
}
[1]=>
object(SimpleXMLElement)#3 (3) {
description"]=>
string(46) "Alberto Moravia's classic psyhcological novel."
}
[2]=>
object(SimpleXMLElement)#4 (3) {
["title"]=>
string(18) "The Sun Also Rises"
["author"]=>
string(16) "Ernest Hemingway"
["description" ]=>
string(49) "The masterpiece that launched Hemingway's career."
}
}
}
http://www.bkjia.com/PHPjc/327494.html
www.bkjia.com
truehttp: //www.bkjia.com/PHPjc/327494.htmlTechArticleA large number of SmipleXML functions can be used to load and parse large amounts of XML documents. -------------------------------------------------- ----------------------------- 1. simpleXML_load_file() function to load...