TYPO3 API  SVNRelease
TemplateParserPatternTest.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*                                                                        *
00004  * This script belongs to the FLOW3 package "Fluid".                      *
00005  *                                                                        *
00006  * It is free software; you can redistribute it and/or modify it under    *
00007  * the terms of the GNU Lesser General Public License as published by the *
00008  * Free Software Foundation, either version 3 of the License, or (at your *
00009  * option) any later version.                                             *
00010  *                                                                        *
00011  * This script is distributed in the hope that it will be useful, but     *
00012  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
00013  * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
00014  * General Public License for more details.                               *
00015  *                                                                        *
00016  * You should have received a copy of the GNU Lesser General Public       *
00017  * License along with the script.                                         *
00018  * If not, see http://www.gnu.org/licenses/lgpl.html                      *
00019  *                                                                        *
00020  * The TYPO3 project - inspiring people to share!                         *
00021  *                                                                        */
00022 
00023 /**
00024  * Testcase for Regular expressions in parser
00025  *
00026  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
00027  */
00028 class Tx_Fluid_Tests_Unit_Core_Parser_TemplateParserPatternTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
00029 
00030     /**
00031      * @test
00032      * @author Sebastian Kurfürst <sebastian@typo3.org>
00033      */
00034     public function testSCAN_PATTERN_NAMESPACEDECLARATION() {
00035         $pattern = str_replace('FLUID_NAMESPACE_SEPARATOR', preg_quote(Tx_Fluid_Fluid::NAMESPACE_SEPARATOR), Tx_Fluid_Core_Parser_TemplateParser::$SCAN_PATTERN_NAMESPACEDECLARATION);
00036         $this->assertEquals(preg_match($pattern, '{namespace f3=Tx_Fluid_blubb}'), 1, 'The SCAN_PATTERN_NAMESPACEDECLARATION pattern did not match a namespace declaration (1).');
00037         $this->assertEquals(preg_match($pattern, '{namespace f3=Tx_Fluid_Blubb }'), 1, 'The SCAN_PATTERN_NAMESPACEDECLARATION pattern did not match a namespace declaration (2).');
00038         $this->assertEquals(preg_match($pattern, '    {namespace f3 = Tx_Fluid_Blubb }    '), 1, 'The SCAN_PATTERN_NAMESPACEDECLARATION pattern did not match a namespace declaration (3).');
00039         $this->assertEquals(preg_match($pattern, ' \{namespace f3 = Tx_Fluid_Blubb }'), 0, 'The SCAN_PATTERN_NAMESPACEDECLARATION pattern did match a namespace declaration even if it was escaped. (1)');
00040         $this->assertEquals(preg_match($pattern, '\{namespace f3 = Tx_Fluid_Blubb }'), 0, 'The SCAN_PATTERN_NAMESPACEDECLARATION pattern did match a namespace declaration even if it was escaped. (2)');
00041     }
00042 
00043     /**
00044      * @test
00045      * @author Sebastian Kurfürst <sebastian@typo3.org>
00046      */
00047     public function testSPLIT_PATTERN_DYNAMICTAGS() {
00048         $pattern = $this->insertNamespaceIntoRegularExpression(Tx_Fluid_Core_Parser_TemplateParser::$SPLIT_PATTERN_TEMPLATE_DYNAMICTAGS, array('f3', 't3', 'f'));
00049 
00050         $source = '<html><head> <f3:a.testing /> <f3:blablubb> {testing}</f4:blz> </t3:hi.jo>';
00051         $expected = array('<html><head> ','<f3:a.testing />', ' ', '<f3:blablubb>', ' {testing}</f4:blz> ', '</t3:hi.jo>');
00052         $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_DYNAMICTAGS pattern did not split the input string correctly with simple tags.');
00053 
00054         $source = 'hi<f3:testing attribute="Hallo>{yep}" nested:attribute="jup" />ja';
00055         $expected = array('hi', '<f3:testing attribute="Hallo>{yep}" nested:attribute="jup" />', 'ja');
00056         $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_DYNAMICTAGS pattern did not split the input string correctly with  > inside an attribute.');
00057 
00058         $source = 'hi<f3:testing attribute="Hallo\"{yep}" nested:attribute="jup" />ja';
00059         $expected = array('hi', '<f3:testing attribute="Hallo\"{yep}" nested:attribute="jup" />', 'ja');
00060         $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_DYNAMICTAGS pattern did not split the input string correctly if a " is inside a double-quoted string.');
00061 
00062         $source = 'hi<f3:testing attribute=\'Hallo>{yep}\' nested:attribute="jup" />ja';
00063         $expected = array('hi', '<f3:testing attribute=\'Hallo>{yep}\' nested:attribute="jup" />', 'ja');
00064         $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_DYNAMICTAGS pattern did not split the input string correctly with single quotes as attribute delimiters.');
00065 
00066         $source = 'hi<f3:testing attribute=\'Hallo\\\'{yep}\' nested:attribute="jup" />ja';
00067         $expected = array('hi', '<f3:testing attribute=\'Hallo\\\'{yep}\' nested:attribute="jup" />', 'ja');
00068         $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_DYNAMICTAGS pattern did not split the input string correctly if \' is inside a single-quoted attribute.');
00069 
00070         $source = 'Hallo <f3:testing><![CDATA[<f3:notparsed>]]></f3:testing>';
00071         $expected = array('Hallo ', '<f3:testing>', '<![CDATA[<f3:notparsed>]]>', '</f3:testing>');
00072         $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_DYNAMICTAGS pattern did not split the input string correctly if there is a CDATA section the parser should ignore.');
00073 
00074         $veryLongViewHelper ='<f:form enctype="multipart/form-data" onsubmit="void(0)" onreset="void(0)" action="someAction" arguments="{arg1: \'val1\', arg2: \'val2\'}" controller="someController" package="somePackage" subpackage="someSubpackage" section="someSection" format="txt" additionalParams="{param1: \'val1\', param2: \'val2\'}" absolute="true" addQueryString="true" argumentsToBeExcludedFromQueryString="{0: \'foo\'}" />';
00075         $source = $veryLongViewHelper . 'Begin' . $veryLongViewHelper . 'End';
00076         $expected = array($veryLongViewHelper, 'Begin', $veryLongViewHelper, 'End');
00077         $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_DYNAMICTAGS pattern did not split the input string correctly if the VH has lots of arguments.');
00078 
00079     }
00080 
00081     /**
00082      * @test
00083      * @author Sebastian Kurfürst <sebastian@typo3.org>
00084      */
00085     public function testSCAN_PATTERN_DYNAMICTAG() {
00086         $pattern = $this->insertNamespaceIntoRegularExpression(Tx_Fluid_Core_Parser_TemplateParser::$SCAN_PATTERN_TEMPLATE_VIEWHELPERTAG, array('f3'));
00087         $source = '<f3:crop attribute="Hallo">';
00088         $expected = array (
00089             0 => '<f3:crop attribute="Hallo">',
00090             'NamespaceIdentifier' => 'f3',
00091             1 => 'f3',
00092             'MethodIdentifier' => 'crop',
00093             2 => 'crop',
00094             'Attributes' => ' attribute="Hallo"',
00095             3 => ' attribute="Hallo"',
00096             'Selfclosing' => '',
00097             4 => ''
00098         );
00099         preg_match($pattern, $source, $matches);
00100         $this->assertEquals($expected, $matches, 'The SCAN_PATTERN_DYNAMICTAG does not match correctly.');
00101 
00102         $source = '<f3:base />';
00103         $expected = array (
00104             0 => '<f3:base />',
00105             'NamespaceIdentifier' => 'f3',
00106             1 => 'f3',
00107             'MethodIdentifier' => 'base',
00108             2 => 'base',
00109             'Attributes' => '',
00110             3 => '',
00111             'Selfclosing' => '/',
00112             4 => '/'
00113         );
00114         preg_match($pattern, $source, $matches);
00115         $this->assertEquals($expected, $matches, 'The SCAN_PATTERN_DYNAMICTAG does not match correctly when there is a space before the self-closing tag.');
00116 
00117         $source = '<f3:crop attribute="Ha\"llo"/>';
00118         $expected = array (
00119             0 => '<f3:crop attribute="Ha\"llo"/>',
00120             'NamespaceIdentifier' => 'f3',
00121             1 => 'f3',
00122             'MethodIdentifier' => 'crop',
00123             2 => 'crop',
00124             'Attributes' => ' attribute="Ha\"llo"',
00125             3 => ' attribute="Ha\"llo"',
00126             'Selfclosing' => '/',
00127             4 => '/'
00128         );
00129         preg_match($pattern, $source, $matches);
00130         $this->assertEquals($expected, $matches, 'The SCAN_PATTERN_DYNAMICTAG does not match correctly with self-closing tags.');
00131 
00132         $source = '<f3:link.uriTo complex:attribute="Ha>llo" a="b" c=\'d\'/>';
00133         $expected = array (
00134             0 => '<f3:link.uriTo complex:attribute="Ha>llo" a="b" c=\'d\'/>',
00135             'NamespaceIdentifier' => 'f3',
00136             1 => 'f3',
00137             'MethodIdentifier' => 'link.uriTo',
00138             2 => 'link.uriTo',
00139             'Attributes' => ' complex:attribute="Ha>llo" a="b" c=\'d\'',
00140             3 => ' complex:attribute="Ha>llo" a="b" c=\'d\'',
00141             'Selfclosing' => '/',
00142             4 => '/'
00143         );
00144         preg_match($pattern, $source, $matches);
00145         $this->assertEquals($expected, $matches, 'The SCAN_PATTERN_DYNAMICTAG does not match correctly with complex attributes and > inside the attributes.');
00146     }
00147 
00148     /**
00149      * @test
00150      * @author Sebastian Kurfürst <sebastian@typo3.org>
00151      */
00152     public function testSCAN_PATTERN_CLOSINGDYNAMICTAG() {
00153         $pattern = $this->insertNamespaceIntoRegularExpression(Tx_Fluid_Core_Parser_TemplateParser::$SCAN_PATTERN_TEMPLATE_CLOSINGVIEWHELPERTAG, array('f3'));
00154         $this->assertEquals(preg_match($pattern, '</f3:bla>'), 1, 'The SCAN_PATTERN_CLOSINGDYNAMICTAG does not match a tag it should match.');
00155         $this->assertEquals(preg_match($pattern, '</f3:bla.a    >'), 1, 'The SCAN_PATTERN_CLOSINGDYNAMICTAG does not match a tag (with spaces included) it should match.');
00156         $this->assertEquals(preg_match($pattern, '</t3:bla>'), 0, 'The SCAN_PATTERN_CLOSINGDYNAMICTAG does match match a tag it should not match.');
00157     }
00158 
00159     /**
00160      * @test
00161      * @author Sebastian Kurfürst <sebastian@typo3.org>
00162      */
00163     public function testSPLIT_PATTERN_TAGARGUMENTS() {
00164         $pattern = Tx_Fluid_Core_Parser_TemplateParser::$SPLIT_PATTERN_TAGARGUMENTS;
00165         $source = ' test="Hallo" argument:post="\'Web" other=\'Single"Quoted\'';
00166         $this->assertEquals(preg_match_all($pattern, $source, $matches, PREG_SET_ORDER), 3, 'The SPLIT_PATTERN_TAGARGUMENTS does not match correctly.');
00167     }
00168 
00169     /**
00170      * @test
00171      * @author Sebastian Kurfürst <sebastian@typo3.org>
00172      */
00173     public function testSPLIT_PATTERN_SHORTHANDSYNTAX() {
00174         $pattern = $this->insertNamespaceIntoRegularExpression(Tx_Fluid_Core_Parser_TemplateParser::$SPLIT_PATTERN_SHORTHANDSYNTAX, array('f3'));
00175 
00176         $source = 'some string{Object.bla}here as well';
00177         $expected = array('some string', '{Object.bla}','here as well');
00178         $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_SHORTHANDSYNTAX pattern did not split the input string correctly with a simple example.');
00179 
00180         $source = 'some {}string\{Object.bla}here as well';
00181         $expected = array('some {}string\\', '{Object.bla}','here as well');
00182         $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_SHORTHANDSYNTAX pattern did not split the input string correctly with an escaped example. (1)');
00183 
00184         $source = 'some {f3:viewHelper()} as well';
00185         $expected = array('some ', '{f3:viewHelper()}',' as well');
00186         $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_SHORTHANDSYNTAX pattern did not split the input string correctly with an escaped example. (2)');
00187 
00188         $source = 'abc {f3:for(arg1: post)} def';
00189         $expected = array('abc ', '{f3:for(arg1: post)}', ' def');
00190         $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_SHORTHANDSYNTAX pattern did not split the input string correctly with an escaped example.(3)');
00191 
00192         $source = 'abc {bla.blubb->f3:for(param:42)} def';
00193         $expected = array('abc ', '{bla.blubb->f3:for(param:42)}', ' def');
00194         $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_SHORTHANDSYNTAX pattern did not split the input string correctly with an escaped example.(4)');
00195 
00196 
00197         $source = 'abc {f3:for(bla:"post{{")} def';
00198         $expected = array('abc ', '{f3:for(bla:"post{{")}', ' def');
00199         $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_SHORTHANDSYNTAX pattern did not split the input string correctly with an escaped example.(5)');
00200 
00201         $source = 'abc {f3:for(param:"abc\"abc")} def';
00202         $expected = array('abc ', '{f3:for(param:"abc\"abc")}', ' def');
00203         $this->assertEquals(preg_split($pattern, $source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY), $expected, 'The SPLIT_PATTERN_SHORTHANDSYNTAX pattern did not split the input string correctly with an escaped example.(6)');
00204     }
00205 
00206     /**
00207      * @test
00208      * @author Sebastian Kurfürst <sebastian@typo3.org>
00209      */
00210     public function testSPLIT_PATTERN_SHORTHANDSYNTAX_VIEWHELPER() {
00211         $pattern = Tx_Fluid_Core_Parser_TemplateParser::$SPLIT_PATTERN_SHORTHANDSYNTAX_VIEWHELPER;
00212 
00213         $source = 'f:for(each: bla)';
00214         $expected = array(
00215             0 => array(
00216                 0 => 'f:for(each: bla)',
00217                 1 => 'f',
00218                 'NamespaceIdentifier' => 'f',
00219                 2 => 'for',
00220                 'MethodIdentifier' => 'for',
00221                 3 => 'each: bla',
00222                 'ViewHelperArguments' => 'each: bla'
00223             )
00224         );
00225         preg_match_all($pattern, $source, $matches, PREG_SET_ORDER);
00226         $this->assertEquals($matches, $expected, 'The SPLIT_PATTERN_SHORTHANDSYNTAX_VIEWHELPER');
00227 
00228         $source = 'f:for(each: bla)->g:bla(a:"b\"->(f:a()", cd: {a:b})';
00229         $expected = array(
00230             0 => array(
00231                 0 => 'f:for(each: bla)',
00232                 1 => 'f',
00233                 'NamespaceIdentifier' => 'f',
00234                 2 => 'for',
00235                 'MethodIdentifier' => 'for',
00236                 3 => 'each: bla',
00237                 'ViewHelperArguments' => 'each: bla'
00238             ),
00239             1 => array(
00240                 0 => 'g:bla(a:"b\"->(f:a()", cd: {a:b})',
00241                 1 => 'g',
00242                 'NamespaceIdentifier' => 'g',
00243                 2 => 'bla',
00244                 'MethodIdentifier' => 'bla',
00245                 3 => 'a:"b\"->(f:a()", cd: {a:b}',
00246                 'ViewHelperArguments' => 'a:"b\"->(f:a()", cd: {a:b}'
00247             )
00248         );
00249         preg_match_all($pattern, $source, $matches, PREG_SET_ORDER);
00250         $this->assertEquals($matches, $expected, 'The SPLIT_PATTERN_SHORTHANDSYNTAX_VIEWHELPER');
00251     }
00252 
00253     /**
00254      * @test
00255      * @author Sebastian Kurfürst <sebastian@typo3.org>
00256      */
00257     public function testSCAN_PATTERN_SHORTHANDSYNTAX_OBJECTACCESSORS() {
00258         $pattern = Tx_Fluid_Core_Parser_TemplateParser::$SCAN_PATTERN_SHORTHANDSYNTAX_OBJECTACCESSORS;
00259         $this->assertEquals(preg_match($pattern, '{object}'), 1, 'Object accessor not identified!');
00260         $this->assertEquals(preg_match($pattern, '{oBject1}'), 1, 'Object accessor not identified if there is a number and capitals inside!');
00261         $this->assertEquals(preg_match($pattern, '{object.recursive}'), 1, 'Object accessor not identified if there is a dot inside!');
00262         $this->assertEquals(preg_match($pattern, '{object-with-dash.recursive_value}'), 1, 'Object accessor not identified if there is a _ or - inside!');
00263         $this->assertEquals(preg_match($pattern, '{f:for()}'), 1, 'Object accessor not identified if it contains only of a ViewHelper.');
00264         $this->assertEquals(preg_match($pattern, '{f:for()->f:for2()}'), 1, 'Object accessor not identified if it contains only of a ViewHelper (nested).');
00265         $this->assertEquals(preg_match($pattern, '{abc->f:for()}'), 1, 'Object accessor not identified if there is a ViewHelper inside!');
00266         $this->assertEquals(preg_match($pattern, '{bla-blubb.recursive_value->f:for()->f:for()}'), 1, 'Object accessor not identified if there is a recursive ViewHelper inside!');
00267         $this->assertEquals(preg_match($pattern, '{f:for(arg1:arg1value, arg2: "bla\"blubb")}'), 1, 'Object accessor not identified if there is an argument inside!');
00268         $this->assertEquals(preg_match($pattern, '{dash:value}'), 0, 'Object accessor identified, but was array!');
00269         //$this->assertEquals(preg_match($pattern, '{}'), 0, 'Object accessor identified, and it was empty!');
00270     }
00271 
00272     /**
00273      * @test
00274      * @author Sebastian Kurfürst <sebastian@typo3.org>
00275      */
00276     public function testSCAN_PATTERN_SHORTHANDSYNTAX_ARRAYS() {
00277         $pattern = Tx_Fluid_Core_Parser_TemplateParser::$SCAN_PATTERN_SHORTHANDSYNTAX_ARRAYS;
00278         $this->assertEquals(preg_match($pattern, '{a:b}'), 1, 'Array syntax not identified!');
00279         $this->assertEquals(preg_match($pattern, '{a:b, c :   d}'), 1, 'Array syntax not identified in case there are multiple properties!');
00280         $this->assertEquals(preg_match($pattern, '{a : 123}'), 1, 'Array syntax not identified when a number is passed as argument!');
00281         $this->assertEquals(preg_match($pattern, '{a:"String"}'), 1, 'Array syntax not identified in case of a double quoted string!');
00282         $this->assertEquals(preg_match($pattern, '{a:\'String\'}'), 1, 'Array syntax not identified in case of a single quoted string!');
00283 
00284         $expected = '{a:{bla:{x:z}, b: a}}';
00285         preg_match($pattern, $expected, $match);
00286         $this->assertEquals($match[0], $expected, 'If nested arrays appear, the string is not parsed correctly.');
00287 
00288         $expected = '{a:"{bla{{}"}';
00289         preg_match($pattern, $expected, $match);
00290         $this->assertEquals($match[0], $expected, 'If nested strings with {} inside appear, the string is not parsed correctly.');
00291     }
00292 
00293     /**
00294      * @test
00295      * @author Sebastian Kurfürst <sebastian@typo3.org>
00296      */
00297     public function testSPLIT_PATTERN_SHORTHANDSYNTAX_ARRAY_PARTS() {
00298         $pattern = Tx_Fluid_Core_Parser_TemplateParser::$SPLIT_PATTERN_SHORTHANDSYNTAX_ARRAY_PARTS;
00299 
00300         $source = '{a: b, e: {c:d, e:f}}';
00301         preg_match_all($pattern, $source, $matches, PREG_SET_ORDER);
00302 
00303         $expected = array(
00304             0 => array(
00305                 0 => 'a: b',
00306                 'ArrayPart' => 'a: b',
00307                 1 => 'a: b',
00308                 'Key' => 'a',
00309                 2 => 'a',
00310                 'QuotedString' => '',
00311                 3 => '',
00312                 'VariableIdentifier' => 'b',
00313                 4 => 'b'
00314             ),
00315             1 => array(
00316                 0 => 'e: {c:d, e:f}',
00317                 'ArrayPart' => 'e: {c:d, e:f}',
00318                 1 => 'e: {c:d, e:f}',
00319                 'Key' => 'e',
00320                 2 => 'e',
00321                 'QuotedString' => '',
00322                 3 => '',
00323                 'VariableIdentifier' => '',
00324                 4 => '',
00325                 'Number' => '',
00326                 5 => '',
00327                 'Subarray' => 'c:d, e:f',
00328                 6 => 'c:d, e:f'
00329             )
00330         );
00331         $this->assertEquals($matches, $expected, 'The regular expression splitting the array apart does not work!');
00332     }
00333 
00334     /**
00335      * Test the SCAN_PATTERN_CDATA which should detect <![CDATA[...]]> (with no leading or trailing spaces!)
00336      *
00337      * @test
00338      * @author Sebastian Kurfürst <sebastian@typo3.org>
00339      */
00340     public function testSCAN_PATTERN_CDATA() {
00341         $pattern = Tx_Fluid_Core_Parser_TemplateParser::$SCAN_PATTERN_CDATA;
00342         $this->assertEquals(preg_match($pattern, '<!-- Test -->'), 0, 'The SCAN_PATTERN_CDATA matches a comment, but it should not.');
00343         $this->assertEquals(preg_match($pattern, '<![CDATA[This is some ]]>'), 1, 'The SCAN_PATTERN_CDATA does not match a simple CDATA string.');
00344         $this->assertEquals(preg_match($pattern, '<![CDATA[This is<bla:test> some ]]>'), 1, 'The SCAN_PATTERN_CDATA does not match a CDATA string with tags inside..');
00345     }
00346 
00347     /**
00348      * Helper method which replaces NAMESPACE in the regular expression with the real namespace used.
00349      *
00350      * @param string $regularExpression The regular expression in which to replace NAMESPACE
00351      * @param array $namespace List of namespace identifiers.
00352      * @return string working regular expression with NAMESPACE replaced.
00353      * @author Sebastian Kurfürst <sebastian@typo3.org>
00354      */
00355     protected function insertNamespaceIntoRegularExpression($regularExpression, $namespace) {
00356         return str_replace('NAMESPACE', implode('|', $namespace), $regularExpression);
00357     }
00358 }
00359 ?>