Update of /cvsroot/phpwebapp/web_app/parser
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3709/parser
Modified Files:
class.Parser.php
Log Message:
Index: class.Parser.php
===================================================================
RCS file: /cvsroot/phpwebapp/web_app/parser/class.Parser.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** class.Parser.php 21 Jul 2004 17:04:31 -0000 1.14
--- class.Parser.php 21 Jul 2004 17:09:10 -0000 1.15
***************
*** 72,76 ****
$tpl = new MainTpl($tpl_file);
if ($this->debug) print "<xmp>\n";
! $tpl = $this->parse_file($tpl_file, $tpl, true);
if ($this->debug) print "</xmp>\n";
--- 72,76 ----
$tpl = new MainTpl($tpl_file);
if ($this->debug) print "<xmp>\n";
! $tpl = $this->parse_file($tpl_file, $tpl);
if ($this->debug) print "</xmp>\n";
***************
*** 87,99 ****
* @param $tpl (optional) the template or template reference
* to be filled by parsing this file.
- * @param $well_formed (optional) when it is true, then the contents
- * of the file is assumed well-formed and is not
- * added the doctype declaration and the root element;
- * usually the main template is well-formed and
- * the others are not
* @return FileTpl an object that contains the parsed $filename,
* return UNDEFINED if $filename is not found.
*/
! function parse_file($filename, $tpl =UNDEFINED, $well_formed =false)
{
global $tplVars;
--- 87,94 ----
* @param $tpl (optional) the template or template reference
* to be filled by parsing this file.
* @return FileTpl an object that contains the parsed $filename,
* return UNDEFINED if $filename is not found.
*/
! function parse_file($filename, $tpl =UNDEFINED)
{
global $tplVars;
***************
*** 118,122 ****
//parse the contents of the file
$file_contents = file_get_contents($filename);
! $tpl = $this->parse_string($file_contents, $tpl, $well_formed);
$tplVars->popScope();
--- 113,117 ----
//parse the contents of the file
$file_contents = file_get_contents($filename);
! $tpl = $this->parse_string($file_contents, $tpl);
$tplVars->popScope();
***************
*** 127,143 ****
/** Parse an xml string into the template given as parameter. */
! function parse_string($xml_string, $tpl =UNDEFINED, $well_formed =false)
{
if ($tpl===UNDEFINED) $tpl = new Template;
! //if (!$well_formed)
if (substr($xml_string, 0, 5) != '<?xml')
{
- //The contents of the string usually is not well-formed xml
- //(does not have <?xml version="1.0" ? > declaration, does not
- //have DOCTYPE declaration, and may not have a single root).
- //In this case the xml parser may not parse it correctly.
- //We make it well-formed by adding additional things taken from
- //the main template. Then the parser discards these things.
$xml_string = $this->xml_prolog . $xml_string . '</html>';
}
--- 122,137 ----
/** Parse an xml string into the template given as parameter. */
! function parse_string($xml_string, $tpl =UNDEFINED)
{
if ($tpl===UNDEFINED) $tpl = new Template;
! //The contents of the string usually is not well-formed xml
! //(does not have <?xml version="1.0" ? > declaration, does not
! //have DOCTYPE declaration, and may not have a single root).
! //In this case the xml parser may not parse it correctly.
! //We make it well-formed by adding additional things taken from
! //the main template. Then the parser discards these things.
if (substr($xml_string, 0, 5) != '<?xml')
{
$xml_string = $this->xml_prolog . $xml_string . '</html>';
}
|