Home > Backend Development > PHP Tutorial > expandablelist PHP and XML: using expat function three

expandablelist PHP and XML: using expat function three

WBOY
Release: 2016-07-29 08:34:52
Original
970 people have browsed it

PHP and XML: Using expat function (3)
How to use this class in a PHP script? It's actually very simple. Here's an example:
First the class definition needs to be included in the script
require (CLASS_DIR."class.Newsboy.php");
Then, we create an instance of the class and set the fileness to that of our XML document Link.
$news = new newsboy();
$news->xml_file = "xml/mynews.xml";
 or
$news->xml_file = "http://xmldocs.mysite.com/mynews.xml"
 Then we call the analyzer to analyze the document.
$news->parse();
  Then we print html to the screen.
print ($news->html);
 And, at the end, the class must be released when completed.
$news->destroy();
 That’s all there is to do.
Section
In this short document, we cover the process of processing XML using PHP:
Simple XML document structure
Defining simple tags for the XML parser
Setting simple options for the XML parser
Configuring the XML parser Register callback function
Use XML parser via a PHP class
Use PHP class in another script

The above introduces expandablelist PHP and XML: Using expat function three, including the content of expandablelist, I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template