[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/ -> xmlize.php (summary)

xmlize.php - xmlize() is by Hans Anderson, {@link http://www.hansanderson.com/contact/} Ye Ole "Feel Free To Use it However" License [PHP, BSD, GPL]. some code in xml_depth is based on code written by other PHPers as well as one Perl script.  Poor programming practice and organization on my part is to blame for the credit these people aren't receiving. None of the code was copyrighted, though.

Author: Hans Anderson
Copyright: Hans Anderson
License: Feel Free To Use it However
Version: This is a stable release, 1.0. I don't foresee any changes, but you
File Size: 228 lines (7 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

xml_format_exception:: (4 methods):
  __construct()
  xmlize()
  xml_depth()
  traverse_xmlize()


Class: xml_format_exception  - X-Ref

Exception thrown when there is an error parsing an XML file.

__construct($errorstring, $line, $char, $link = '')   X-Ref
No description

xmlize($data, $whitespace = 1, $encoding = 'UTF-8', $reporterrors = false)   X-Ref
Create an array structure from an XML string.

Usage:<br>
<code>
$xml = xmlize($array);
</code>
See the function {@link traverse_xmlize()} for information about the
structure of the array, it's much easier to explain by showing you.
Be aware that the array is somewhat tricky.  I use xmlize all the time,
but still need to use {@link traverse_xmlize()} quite often to show me the structure!

THIS IS A PHP 5 VERSION:

This modified version basically has a new optional parameter
to specify an OUTPUT encoding. If not specified, it defaults to UTF-8.
I recommend you to read this PHP bug. There you can see how PHP4, PHP5.0.0
and PHP5.0.2 will handle this.
{@link http://bugs.php.net/bug.php?id=29711}
Ciao, Eloy :-)

param: string $data The XML source to parse.
param: int $whitespace  If set to 1 allows the parser to skip "space" characters in xml document. Default is 1
param: string $encoding Specify an OUTPUT encoding. If not specified, it defaults to UTF-8.
param: bool $reporterrors if set to true, then a {@link xml_format_exception}
return: array representation of the parsed XML.

xml_depth($vals, &$i)   X-Ref


traverse_xmlize($array, $arrName = 'array', $level = 0)   X-Ref
This helps you understand the structure of the array {@link xmlize()} outputs

Function by acebone@f2s.com, a HUGE help!<br>
Usage:<br>
<code>
traverse_xmlize($xml, 'xml_');
print '<pre>' . implode("", $traverse_array . '</pre>';
</code>
param: array $array ?
param: string $arrName ?
param: int $level ?
return: int
author: acebone@f2s.com



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1