cvs: pear /Tree/Memory XML.php

From: Date: Sun, 02 Jun 2002 18:00:24 +0000
Subject: cvs: pear /Tree/Memory XML.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4374@lists.php.net to get a copy of this message
cain Sun Jun 2 14:00:24 2002 EDT Modified files: /pear/Tree/Memory XML.php Log: - convert all tags to lower case by default Index: pear/Tree/Memory/XML.php diff -u pear/Tree/Memory/XML.php:1.3 pear/Tree/Memory/XML.php:1.4 --- pear/Tree/Memory/XML.php:1.3 Fri Mar 22 03:10:19 2002 +++ pear/Tree/Memory/XML.php Sun Jun 2 14:00:22 2002 @@ -16,7 +16,7 @@ // | Authors: Wolfram Kriesing <wolfram@kriesing.de> | // +----------------------------------------------------------------------+ // -// $Id: XML.php,v 1.3 2002/03/22 08:10:19 ssb Exp $ +// $Id: XML.php,v 1.4 2002/06/02 18:00:22 cain Exp $ require_once "XML/Parser.php"; @@ -52,9 +52,12 @@ var $folding = false; // turn off case folding /** - * @var integer $depth + * @var boolean if true it converts all attributes and tag names etc to lower case + * this is default, since i dont see no way of case insensitive comparison + * in the tree class, since you can access the internal data directly + * or you get them returned ... i know this is not 100% proper OOP but that's how it is right now */ - var $depth = 0; + var $_toLower = true; /** * @@ -93,9 +96,16 @@ $curId = sizeof($this->data); $this->data[$curId]['id'] = $curId; - $this->data[$curId]['name'] = $element; + $this->data[$curId]['name'] = $this->_toLower ? strtolower($element) : $element; $this->data[$curId]['level'] = $this->level; $this->data[$curId]['attributes'] = $attribs; + if( $this->_toLower ) + { + $this->data[$curId]['attributes'] = array(); + foreach( $attribs as $key=>$value ) + $this->data[$curId]['attributes'][strtolower($key)] = $value; + } + if( isset($this->data[$elementBeforeId]['level']) && $this->level == $this->data[$elementBeforeId]['level'] ) // is that a new child, or just a 'next' of a child? { @@ -149,6 +159,7 @@ # for each xml_parse() call. if( !isset($this->data[ sizeof($this->data)-1 ]['cdata']) ) $this->data[ sizeof($this->data)-1 ]['cdata'] = ''; +#print "cdata = '$cdata'\r\n"; $this->data[ sizeof($this->data)-1 ]['cdata'].= $cdata; }

« previous php.pear.cvs (#4374) next »