Source for file Parser.inc

Documentation is available at Parser.inc

  1. <?php /*-*- mode: php; tab-width:4 -*-*/
  2.  
  3.   /* java_Parser.php -- A bridge which either uses a C based
  4.    parser or the pure PHP parser.
  5.  
  6.    Copyright (C) 2003-2007 Jost Boekemeier
  7.  
  8.    This file is part of the PHP/Java Bridge.
  9.  
  10.    The PHP/Java Bridge ("the library") is free software; you can
  11.    redistribute it and/or modify it under the terms of the GNU General
  12.    Public License as published by the Free Software Foundation; either
  13.    version 2, or (at your option) any later version.
  14.  
  15.    The library is distributed in the hope that it will be useful, but
  16.    WITHOUT ANY WARRANTY; without even the implied warranty of
  17.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  18.    General Public License for more details.
  19.  
  20.    You should have received a copy of the GNU General Public License
  21.    along with the PHP/Java Bridge; see the file COPYING.  If not, write to the
  22.    Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  23.    02111-1307 USA.
  24.  
  25.    Linking this file statically or dynamically with other modules is
  26.    making a combined work based on this library.  Thus, the terms and
  27.    conditions of the GNU General Public License cover the whole
  28.    combination.
  29.  
  30.    As a special exception, the copyright holders of this library give you
  31.    permission to link this library with independent modules to produce an
  32.    executable, regardless of the license terms of these independent
  33.    modules, and to copy and distribute the resulting executable under
  34.    terms of your choice, provided that you also meet, for each linked
  35.    independent module, the terms and conditions of the license of that
  36.    module.  An independent module is a module which is not derived from
  37.    or based on this library.  If you modify this library, you may extend
  38.    this exception to your version of the library, but you are not
  39.    obligated to do so.  If you do not wish to do so, delete this
  40.    exception statement from your version. */
  41.  
  42. require_once("${JAVA_BASE}/SimpleParser.inc");
  43. require_once("${JAVA_BASE}/NativeParser.inc");
  44.  
  45. /**
  46.  * @access private
  47.  */
  48. class java_Parser {
  49.   public $ENABLE_NATIVE true;
  50.   public $DISABLE_SIMPLEfalse;
  51.   public $parser;
  52.  
  53.   function java_Parser($handler{
  54.     if($this->ENABLE_NATIVE && function_exists("xml_parser_create")) {
  55.       $this->parser new java_NativeParser($handler);
  56.       $handler->RUNTIME["PARSER"]="NATIVE";
  57.     else {
  58.       if($this->DISABLE_SIMPLEdie("no parser");
  59.       $this->parser new java_SimpleParser($handler);
  60.       $handler->RUNTIME["PARSER"]="SIMPLE";
  61.     }
  62.   }
  63.   function parse({
  64.     $this->parser->parse();
  65.   }
  66.   function getData($str{
  67.     return $this->parser->getData($str);
  68.   }
  69.   function parserError({
  70.     $this->parser->parserError();
  71.   }
  72. }

Documentation generated on Sun, 16 Mar 2008 19:11:47 +0100 by phpDocumentor 1.4.0a2