cvs: pear /XML_Transformer README Transformer.php package.xml /XML_Transformer/Transformer Util.php

From: Date: Sat, 27 Sep 2003 06:28:01 +0000
Subject: cvs: pear /XML_Transformer README Transformer.php package.xml /XML_Transformer/Transformer Util.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-13124@lists.php.net to get a copy of this message
sebastian Sat Sep 27 02:28:01 2003 EDT Modified files: /pear/XML_Transformer README Transformer.php package.xml /pear/XML_Transformer/Transformer Util.php Log: Use XML_Util::splitQualifiedName().

Index: pear/XML_Transformer/README diff -u pear/XML_Transformer/README:1.11 pear/XML_Transformer/README:1.12 --- pear/XML_Transformer/README:1.11 Fri Sep 26 12:52:35 2003 +++ pear/XML_Transformer/README Sat Sep 27 02:28:00 2003 @@ -95,25 +95,7 @@ maintained automatically by XML_Transformer. You never use it directly. -2.3 XML_Transformer_Util - -The other auxiliary class is actually only a collection of static methods, -XML_Transformer_Util. As such, it does not have any instances at all, but -provides functionality, which can be used by XML_Transformer or your own -classes. - -The qualifiedElement() method takes a tag name or possibly a namespace:tag -combination and returns an array of namespace and tag name. If the tag name has -no namespace, the namespace is returned as '&MAIN'. - - list($namespace, $element ) = XML_Transformer_Util::qualifiedElement('img'); - - /* - * returns array('&MAIN', 'img'); - */ - - -2.4 XML_Transformer_Namespace +2.3 XML_Transformer_Namespace Using XML_Transformer, all transformations are specified for namespaces. You may specifiy transformations for the empty namespace, that is, you may transform @@ -196,7 +178,7 @@ should set secondPassRequired to true (default: false). -2.4.1 Using autoloading +2.3.1 Using autoloading We have supplied a number of subclasses to XML_Transformer_Namespace. These reside in a directory "./Transformer/Namespace" relative to the directory of the @@ -243,7 +225,7 @@ You must specify autoloading as a flag to the constructor. -2.5 supplied XML_Transformer Namespaces +2.4 supplied XML_Transformer Namespaces All namespaces we supply are derived from XML_Transformer_Namespace and subject to the limitations and interfaces of this baseclass. @@ -275,7 +257,7 @@ interesting code. -2.5.1 XML_Transformer_Namespace_Anchor +2.4.1 XML_Transformer_Namespace_Anchor The Anchor namespace implements a number of tags that create indirect named links (URNs): The link is specified by name, and the actual link location and @@ -285,7 +267,7 @@ The default namespace prefix for this Namespace is "a". -2.5.1.1 Link database +2.4.1.1 Link database The link database is maintained internally as an array, _anchorDatabase and is accessible through the setDatabase($db) and $db = getDatabase() accessor @@ -330,7 +312,7 @@ will be reproduced "as is" on the generated links. -2.5.1.2 The <a:iref> tag +2.4.1.2 The <a:iref> tag The <a:iref iref="name" /> container will look the given name up in the database and produce a HTML <a /> container. The attributes find in the link database @@ -347,7 +329,7 @@ Homepage</a> -2.5.1.3 The <a:random> tag +2.4.1.3 The <a:random> tag The <a:random /> container will select a random name from the database and link to it. The contents of the <a:random /> become the contents of the generated @@ -362,7 +344,7 @@ <a href="http://www.php.net" title="PHP Homepage">A random link</a> -2.5.1.4 The <a:link> tag +2.4.1.4 The <a:link> tag The link tag will add a link to the database, and vanishes (generates no output). The name attribute to link will define the link name, the other @@ -379,13 +361,13 @@ The link is added to the database. No output is being generated. -2.5.2 XML_Transformer_Namespace_DocBook +2.4.2 XML_Transformer_Namespace_DocBook * TODO (sb) -2.5.3 XML_Transformer_Namespace_Image +2.4.3 XML_Transformer_Namespace_Image The Image namespace implements a number of tags that are loosely related to images. At the moment there is a tag that autogenerates height/width attributes @@ -394,7 +376,7 @@ The default namespace prefix for this namespace is "img". -2.5.3.1 The <img> tag. +2.4.3.1 The <img> tag. This tag will generate a <img /> tag with the original attributes, and will add width and height attributes if possible. @@ -408,7 +390,7 @@ <img alt="blah" height="168" src="somepng.png" width="320" /> -2.5.3.2 The <gtext> tag +2.4.3.2 The <gtext> tag Gtext is short for graphical text. The tag will take its content and turn it into a single PNG or a series of PNGs using ImageTTFText() internally. @@ -514,7 +496,7 @@ <img:gtext split="char">Alphabet Soup!</img:gtext> -2.5.3.3 The <gtextdefault> tag +2.4.3.3 The <gtextdefault> tag <img:gtextdefault /> takes all attributes of <img:gtext /> and stores them. These attributes are then supplied to all subsequent <img:gtext /> calls. They @@ -527,15 +509,15 @@ See above, <img:gtext /> for an example. -2.5.4 XML_Transformer_Namespace_PHP +2.4.4 XML_Transformer_Namespace_PHP -2.5.5 XML_Transformer_Namespace_Widget +2.4.5 XML_Transformer_Namespace_Widget -2.6 XML_Transformer_Driver_Cache +2.5 XML_Transformer_Driver_Cache * TODO (sb) -2.7 XML_Transformer_Driver_OutputBuffer +2.6 XML_Transformer_Driver_OutputBuffer * TODO (sb) Index: pear/XML_Transformer/Transformer.php diff -u pear/XML_Transformer/Transformer.php:1.114 pear/XML_Transformer/Transformer.php:1.115 --- pear/XML_Transformer/Transformer.php:1.114 Fri Sep 26 13:05:00 2003 +++ pear/XML_Transformer/Transformer.php Sat Sep 27 02:28:00 2003 @@ -13,7 +13,7 @@ // | license@php.net so we can mail you a copy immediately. | // +---------------------------------------------------------------------------+ // -// $Id: Transformer.php,v 1.114 2003/09/26 17:05:00 sebastian Exp $ +// $Id: Transformer.php,v 1.115 2003/09/27 06:28:00 sebastian Exp $ // require_once 'XML/Transformer/CallbackRegistry.php'; @@ -29,7 +29,7 @@ * * @author Sebastian Bergmann <sb@sebastian-bergmann.de> * @author Kristian Köhntopp <kris@koehntopp.de> -* @version $Revision: 1.114 $ +* @version $Revision: 1.115 $ * @access public */ class XML_Transformer { @@ -472,11 +472,9 @@ function _startElement($parser, $element, $attributes) { $attributes = $this->canonicalize($attributes); $element = $this->canonicalize($element); + $qElement = XML_Util::splitQualifiedName($element, '&MAIN'); $process = $this->_lastProcessed != $element; - list($namespacePrefix, $qElement) = - XML_Transformer_Util::qualifiedElement($element); - // Push element's name and attributes onto the stack. $this->_level++; @@ -495,12 +493,12 @@ } if ($process && - isset($this->_callbackRegistry->overloadedNamespaces[$namespacePrefix]['active'])) { + isset($this->_callbackRegistry->overloadedNamespaces[$qElement['namespace']]['active'])) { // The event is handled by a callback // that is registered for this namespace. - $cdata = $this->_callbackRegistry->overloadedNamespaces[$namespacePrefix]['object']->startElement( - $qElement, + $cdata = $this->_callbackRegistry->overloadedNamespaces[$qElement['namespace']]['object']->startElement( + $qElement['localPart'], $attributes ); } else { @@ -530,19 +528,17 @@ function _endElement($parser, $element) { $cdata = $this->_cdataStack[$this->_level]; $element = $this->canonicalize($element); + $qElement = XML_Util::splitQualifiedName($element, '&MAIN'); $process = $this->_lastProcessed != $element; $recursion = false; - list($namespacePrefix, $qElement) = - XML_Transformer_Util::qualifiedElement($element); - if ($process && - isset($this->_callbackRegistry->overloadedNamespaces[$namespacePrefix]['active'])) { + isset($this->_callbackRegistry->overloadedNamespaces[$qElement['namespace']]['active'])) { // The event is handled by a callback // that is registered for this namespace. - $result = $this->_callbackRegistry->overloadedNamespaces[$namespacePrefix]['object']->endElement( - $qElement, + $result = $this->_callbackRegistry->overloadedNamespaces[$qElement['namespace']]['object']->endElement( + $qElement['localPart'], $cdata ); @@ -556,7 +552,7 @@ $recursion = $reparse && isset($this->_elementStack[$this->_level-1]) && - $this->_callbackRegistry->overloadedNamespaces[$namespacePrefix]['recursiveOperation']; + $this->_callbackRegistry->overloadedNamespaces[$qElement['namespace']]['recursiveOperation']; } else { // No callback was registered for this element's // closing tag, copy it. Index: pear/XML_Transformer/package.xml diff -u pear/XML_Transformer/package.xml:1.69 pear/XML_Transformer/package.xml:1.70 --- pear/XML_Transformer/package.xml:1.69 Fri Sep 26 12:52:35 2003 +++ pear/XML_Transformer/package.xml Sat Sep 27 02:28:00 2003 @@ -29,8 +29,11 @@ <date>200Y-MM-DD</date> <notes> <![CDATA[ -- Removed XML_Transformer_Util::attributesToString() - method in favour of XML_Util::attributesToString(). +- Replaced XML_Transformer_Util::attributesToString() + with XML_Util::attributesToString(). + +- Replaced XML_Transformer_Util::qualifiedElement() + with XML_Util::splitQualifiedName(). ! The XML_Util package is now required. ]]> @@ -62,7 +65,7 @@ <deps> <dep type="php" rel="ge" version="4.2.0" /> <dep type="ext" rel="has">xml</dep> - <dep type="pkg" rel="has">XML_Util</dep> + <dep type="pkg" rel="ge" version="0.5.1">XML_Util</dep> </deps> </release> <changelog> Index: pear/XML_Transformer/Transformer/Util.php diff -u pear/XML_Transformer/Transformer/Util.php:1.10 pear/XML_Transformer/Transformer/Util.php:1.11 --- pear/XML_Transformer/Transformer/Util.php:1.10 Fri Sep 26 12:52:36 2003 +++ pear/XML_Transformer/Transformer/Util.php Sat Sep 27 02:28:01 2003 @@ -13,7 +13,7 @@ // | license@php.net so we can mail you a copy immediately. | // +---------------------------------------------------------------------------+ // -// $Id: Util.php,v 1.10 2003/09/26 16:52:36 sebastian Exp $ +// $Id: Util.php,v 1.11 2003/09/27 06:28:01 sebastian Exp $ // /** @@ -21,7 +21,7 @@ * * @author Sebastian Bergmann <sb@sebastian-bergmann.de> * @author Kristian Köhntopp <kris@koehntopp.de> -* @version $Revision: 1.10 $ +* @version $Revision: 1.11 $ * @access public */ class XML_Transformer_Util { @@ -46,26 +46,6 @@ default: { error_log($logMessage); } - } - } - - // }}} - // {{{ function qualifiedElement($element) - - /** - * Returns namespace and qualified element name - * for a given element. - * - * @param string - * @return array - * @access public - * @static - */ - function qualifiedElement($element) { - if (strstr($element, ':')) { - return explode(':', $element); - } else { - return array('&MAIN', $element); } }
« previous php.pear.cvs (#13124) next »