XML_Transformer
[ class tree: XML_Transformer ] [ index: XML_Transformer ] [ all elements ]

Class: XML_Transformer_Namespace

Source Location: /XML_Transformer-1.1.2/XML/Transformer/Namespace.php

Class Overview


Convenience Base Class for Namespace Transformers.


Author(s):

Variables

Methods


Child classes:

XML_Transformer_Namespace_PHP
Handler for the PHP Namespace.
XML_Transformer_Namespace_DocBook
DocBook Namespace Handler.
XML_Transformer_Namespace_Widget
Handler for the Widget Namespace.
XML_Transformer_Namespace_Image
Handler for the Image Namespace.
XML_Transformer_Namespace_Anchor
Handler for the Anchor Namespace.

Inherited Variables

Inherited Methods


Class Details

[line 73]
Convenience Base Class for Namespace Transformers.

Example

  1.  <?php
  2.  require_once 'XML/Transformer.php';
  3.  require_once 'XML/Transformer/Namespace.php';
  4.  
  5.  class Image extends XML_Transformer_Namespace {
  6.      var $imageAttributes = array();
  7.  
  8.      function truePath($path{
  9.          if (php_sapi_name(== 'apache'{
  10.              $r    = apache_lookup_uri($path);
  11.              $path $r->filename;
  12.          else {
  13.              $path $_SERVER['DOCUMENT_ROOT'. "/$path";
  14.          }
  15.  
  16.          return $path;
  17.      }
  18.  
  19.      function start_img($attributes{
  20.          $this->imageAttributes $attributes;
  21.          return '';
  22.      }
  23.  
  24.      function end_img($cdata{
  25.          $src $this->truePath($this->imageAttributes['src']);
  26.          list($w$h$t$whsgetimagesize($src);
  27.  
  28.          $this->imageAttributes['height'$w;
  29.          $this->imageAttributes['width']  $h;
  30.  
  31.          return sprintf(
  32.            '<img %s/>',
  33.            XML_Transformer::attributesToString($this->imageAttributes)
  34.          );
  35.      }
  36.  }
  37.  ?>



[ Top ]


Class Variables

$defaultNamespacePrefix =  ''

[line 80]

  • Access: public

Type:   string


[ Top ]

$secondPassRequired =  FALSE

[line 86]

  • Access: public

Type:   boolean


[ Top ]



Method Detail

endElement   [line 155]

array endElement( string $element, string $cdata)

Wrapper for endElement handler.
  • Access: public

Parameters:

string   $element   — 
string   $cdata   — 

[ Top ]

getLock   [line 183]

boolean getLock( )

Lock all other namespace handlers.

[ Top ]

initObserver   [line 113]

void initObserver( string $prefix, object &$object)

Called by XML_Transformer at initialization time.

We use this to remember our namespace prefixes (there can be multiple) and a pointer to the Transformer object.

  • Access: public

Parameters:

string   $prefix   — 
object   &$object   — 

[ Top ]

releaseLock   [line 196]

void releaseLock( )

Releases a lock.

[ Top ]

startElement   [line 129]

string startElement( string $element, array $attributes)

Wrapper for startElement handler.
  • Access: public

Parameters:

string   $element   — 
array   $attributes   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:48:10 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.