ExtractingElementCreator Class Reference

Inheritance diagram for ExtractingElementCreator:

ElementCreator List of all members.

Detailed Description

ElementCreator descendant which allows you to set regex for extracting part of passed content text to use for creating the element.

I guess that nobody have understood previous sentence.

Definition at line 101 of file xmlutils.php.

Public Member Functions

 __construct ($regex, $name, $attrs=NULL)
 create_element ($doc, $content)
 Creates the XML element.

Protected Attributes

 $regex
 Regular expression used for extracting.


Member Function Documentation

ExtractingElementCreator::__construct regex,
name,
attrs = NULL
 

See also:
ElementCreator::__construct()
Parameters:
[in] $regex Regular expression used for extracting.

Definition at line 110 of file xmlutils.php.

References $regex.

00110                                                        {
00111       $this->regex = $regex;
00112       parent::__construct($name, $attrs);
00113     }

ExtractingElementCreator::create_element doc,
content
 

Creates the XML element.

See also:
ElementCreator::create_element()
Parameters:
[in] $content String content of the element. It's passed to the preg_match function and first captured parenthesized subpattern is used as a real content of the element.
Exceptions:
Exception If there is no match.

Reimplemented from ElementCreator.

Definition at line 124 of file xmlutils.php.

00124                                             {
00125       if (preg_match($this->regex, $content, $matches)):
00126         return parent::create_element($doc, $matches[1]);
00127       endif;
00128       throw new Exception(
00129         sprintf(
00130           "ExtractingElementCreator::create_element() error: Nothing matched! Regex: >%s< String: >%s<",
00131           $this->regex, $content
00132         )
00133       );
00134     }


Member Data Documentation

ExtractingElementCreator::$regex [protected]
 

Regular expression used for extracting.

Definition at line 104 of file xmlutils.php.

Referenced by __construct().


The documentation for this class was generated from the following file:
Generated on Sat Sep 24 01:26:43 2005 for Easy PHP Framework by  doxygen 1.4.2