Subversion Repositories Applications.gtt

Compare Revisions

Regard whitespace Rev 186 → Rev 187

/trunk/bibliotheque/pear/PEAR/XMLParser.php
1,22 → 1,15
<?php
/**
* PEAR_FTP
* PEAR_XMLParser
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @author Stephan Schmidt (original XML_Unserializer code)
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: XMLParser.php,v 1.12 2006/03/27 04:39:03 cellog Exp $
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license New BSD License
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.4.0a1
*/
27,9 → 20,9
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @author Stephan Schmidt (original XML_Unserializer code)
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.5.1
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license New BSD License
* @version Release: 1.10.1
* @link http://pear.php.net/package/PEAR
* @since Class available since Release 1.4.0a1
*/
66,6 → 59,12
var $_depth = 0;
 
/**
* The XML encoding to use
* @var string $encoding
*/
var $encoding = 'ISO-8859-1';
 
/**
* @return array
*/
function getData()
83,22 → 82,19
include_once 'PEAR.php';
return PEAR::raiseError("XML Extension not found", 1);
}
$this->_valStack = array();
$this->_dataStack = array();
$this->_dataStack = $this->_valStack = array();
$this->_depth = 0;
 
if (version_compare(phpversion(), '5.0.0', 'lt')) {
if (strpos($data, 'encoding="UTF-8"')) {
$data = utf8_decode($data);
if (
strpos($data, 'encoding="UTF-8"')
|| strpos($data, 'encoding="utf-8"')
|| strpos($data, "encoding='UTF-8'")
|| strpos($data, "encoding='utf-8'")
) {
$this->encoding = 'UTF-8';
}
$xp = xml_parser_create('ISO-8859-1');
} else {
if (strpos($data, 'encoding="UTF-8"')) {
$xp = xml_parser_create('UTF-8');
} else {
$xp = xml_parser_create('ISO-8859-1');
}
}
 
$xp = xml_parser_create($this->encoding);
xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, 0);
xml_set_object($xp, $this);
xml_set_element_handler($xp, 'startHandler', 'endHandler');
125,8 → 121,6
*/
function startHandler($parser, $element, $attribs)
{
$type = 'string';
 
$this->_depth++;
$this->_dataStack[$this->_depth] = null;
 
133,7 → 127,7
$val = array(
'name' => $element,
'value' => null,
'type' => $type,
'type' => 'string',
'childrenKeys' => array(),
'aggregKeys' => array()
);
141,9 → 135,7
if (count($attribs) > 0) {
$val['children'] = array();
$val['type'] = 'array';
 
$val['children']['attribs'] = $attribs;
 
}
 
array_push($this->_valStack, $val);
175,19 → 167,13
 
// adjust type of the value
switch(strtolower($value['type'])) {
 
/*
* unserialize an array
*/
// unserialize an array
case 'array':
if ($data !== '') {
$value['children']['_content'] = $data;
}
if (isset($value['children'])) {
$value['value'] = $value['children'];
} else {
$value['value'] = array();
}
 
$value['value'] = isset($value['children']) ? $value['children'] : array();
break;
 
/*
205,12 → 191,14
$value['value'] = $data;
break;
}
 
$parent = array_pop($this->_valStack);
if ($parent === null) {
$this->_unserializedData = &$value['value'];
$this->_root = &$value['name'];
return true;
} else {
}
 
// parent has to be an array
if (!isset($parent['children']) || !is_array($parent['children'])) {
$parent['children'] = array();
240,7 → 228,6
array_push($parent['children'],$value['value']);
}
array_push($this->_valStack, $parent);
}
 
$this->_depth--;
}
257,5 → 244,4
{
$this->_dataStack[$this->_depth] .= $cdata;
}
}
?>
}