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

Class: XML_Parser2_Simple

Source Location: /XML_Parser2-0.1.0/XML/Parser2/Simple.php

Class Overview

XML_Parser2
   |
   --XML_Parser2_Simple

Simple XML parser class.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2004-2008 The PHP Group

Variables

Methods


Child classes:

Simple XML parser class.
myParser2
Simple XML parser class.

Inherited Variables

Inherited Methods

Class: XML_Parser2

XML_Parser2::__construct()
PHP5 constructor
XML_Parser2::endHandler()
abstract method signature for End Handler
XML_Parser2::free()
XML_Parser2::free()
XML_Parser2::funcEndHandler()
derives and calls the End Handler function
XML_Parser2::funcStartHandler()
derives and calls the Start Handler function
XML_Parser2::parse()
Central parsing function.
XML_Parser2::parseString()
XML_Parser2::parseString()
XML_Parser2::reset()
Reset the parser.
XML_Parser2::setHandlerObj()
Sets the object, that will handle the XML events
XML_Parser2::setInput()
Sets the file handle to use with parse().
XML_Parser2::setInputFile()
Sets the input xml file to be parsed
XML_Parser2::setInputString()
XML_Parser2::setInputString()
XML_Parser2::setMode()
Sets the mode of the parser.
XML_Parser2::startHandler()
abstract method signature for Start Handler

Class Details

[line 92]
Simple XML parser class.

This class is a simplified version of XML_Parser2. In most XML applications the real action is executed, when a closing tag is found.

XML_Parser2_Simple allows you to just implement one callback for each tag that will receive the tag with its attributes and CData.

  1.  require_once '../Parser/Simple.php';
  2.  
  3.  class myParser extends XML_Parser2_Simple
  4.  {
  5.  
  6.     function handleElement($name$attribs$data)
  7.      {
  8.          printf('handle %s<br>'$name);
  9.      }
  10.  }
  11.  
  12.  $p = new myParser();
  13.  
  14.  $result $p->setInputFile('myDoc.xml');
  15.  $result $p->parse();



[ Top ]


Class Variables

$handler = array(
        'default_handler'                   => 'defaultHandler',
        'processing_instruction_handler'    => 'piHandler',
        'unparsed_entity_decl_handler'      => 'unparsedHandler',
        'notation_decl_handler'             => 'notationHandler',
        'external_entity_ref_handler'       => 'entityrefHandler'
    )

[line 123]

Mapping from expat handler function to class method.

Type:   array
Overrides:   Array


[ Top ]



Method Detail

addToData   [line 296]

void addToData( string $data)

add some string to the current ddata.

This is commonly needed, when a document is parsed recursively.

  • Access: public

Parameters:

string   $data   —  data to add

[ Top ]

getCurrentDepth   [line 281]

integer getCurrentDepth( )

get the current tag depth

The root tag is in depth 0.

  • Access: public

[ Top ]

handleElement   [line 269]

void handleElement( string $name, array $attribs, string $data)

handle a tag

Implement this in your parser

  • Abstract:
  • Access: public

Parameters:

string   $name   —  element name
array   $attribs   —  attributes
string   $data   —  character data

[ Top ]

reset   [line 173]

boolean|object reset( )

Reset the parser.

This allows you to use one parser instance to parse multiple XML documents.

  • Return: true on success, PEAR_Error otherwise
  • Access: public

Overrides XML_Parser2::reset() (Reset the parser.)
[ Top ]


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