Login   Register  
PHP Classes
elePHPant
Icontem

File: index.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of GOsha  >  PHP XML Little Parser  >  index.php  >  Download  
File: index.php
Role: Example script
Content type: text/plain
Description: xml_little_parser index file
Class: PHP XML Little Parser
Parse XML documents into nested arrays
Author: By
Last change:
Date: 5 years ago
Size: 824 bytes
 

Contents

Class file image Download
<html>
<body>
<?php
//error_reporting(15);
require ('xml.class.php');
Echo 
"PHP XML-LittleParser:<br>";
$pd '
<news>
    <author>GOsha</author>
    <pubnum>300</pubnum>
    <text>
        <head> 123 </head>
        <content> Text </content>
    </text>
    <ca attrib="123" attr2 = "12">TestCA</ca>
</news>
'
;

//This class can parse only straight-line XML, not parallel!!!
//See example.
//If we have 2 identical properties such as:
//<author id="1">GOsha</author>
//<author id="2">Mbisha</author>
//it will returns Mbisha in "author" nest and id=2 in properties.

$XC = new XMLParser;
$XC->xml_data $pd;
//$XC->xml_attr_varname = "xml_attr";
//$XC->xml_data_varname = "xml_data";
//$XC->xml_encoding = "utf-8";
$p_result $XC->Parse();
Echo 
"<pre>";
Echo 
print_r($p_result);
Echo 
"</pre>";
?>
</body>
</html>