PHPBuilder - PHP and XML: Using the expat functions Page 5



RSS Twitter
Articles Php Functions

PHP and XML: Using the expat functions - Page 5

by: Justin Grant
|
July 30, 2000

How do you use this class in a PHP script ? It's very simple actually. Here is 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 file property to the actual location of our XML document:
$news = new newsboy();
$news->xml_file = "xml/mynews.xml";
Or:
$news->xml_file = "http://xmldocs.mysite.com/mynews.xml"
Then we call the parse method to parse the document:
$news->parse();
Then we print out the html to the browser:
print ($news->html);
And, lastly when done with the object we must destroy it:
$news->destroy();
And that's really all there is to it !!!

« Previous Page
1
|
2
|
3
|
4
|
5
|
6
Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Justin Grant

Comment:



Comment:

(Maximum characters: 1200). You have characters left.