SEO and Internet newsnews

XML & Php

Simple XML parser

Copy and paste the following code into your editor and run it (code comments are included).
If you want to see the live result, try it here (new window).

This example reads an xml file and parses it to extract and layout desired dataset encoded in UTF-8.

The example xml file which is ISO-8859-1 encoded:

The source code:

Notes:
- you need to have PHP 4 or above version of Php;
- you may call any remote xml/rss/atom files, but you need to know about the structure and tag names of the file.

You may wish to read additional materials from:
- function.xml-parser-create
- function.xml-set-element-handler
- function.xml-set-character-data-handler.php
- function.xml-parse.php
- php.net/global

Comments

Post a comment now
Add Url to Linkstraffic - Website traffic - Affiliates - Site Map