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:
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";
$news->xml_file = "http://xmldocs.mysite.com/mynews.xml"
Then we call the parse method to parse the document:
Then we print out the html to the browser:
And, lastly when done with the object we must destroy it:
And that's really all there is to it !!!