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

Class: XML_HTMLSax3

Source Location: /XML_HTMLSax3-3.0.0/HTMLSax3.php

Class Overview


User interface class. All user calls should only be made to this class


Author(s):

Methods


Inherited Variables

Inherited Methods


Class Details

[line 460]
User interface class. All user calls should only be made to this class
  • Access: public


[ Top ]


Method Detail

XML_HTMLSax3 (Constructor)   [line 484]

XML_HTMLSax3 XML_HTMLSax3( )

Constructs XML_HTMLSax3 selecting concrete StateParser subclass

depending on PHP version being used as well as setting the default NullHandler for all callbacks
Example:

 $myHandler = & new MyHandler();
 $parser = new XML_HTMLSax3();
 $parser->set_object($myHandler);
 $parser->set_option('XML_OPTION_CASE_FOLDING');
 $parser->set_element_handler('myOpenHandler','myCloseHandler');
 $parser->set_data_handler('myDataHandler');
 $parser->parser($xml);

  • Access: public

[ Top ]

get_current_position   [line 664]

int get_current_position( )

Returns the current string position of the "cursor" inside the XML document
Intended for use from within a user defined handler called via the $parser reference e.g.

 function myDataHandler(& $parser,$data) {
     echo( 'Current position: '.$parser->get_current_position() );
 }


[ Top ]

get_length   [line 673]

int get_length( )

Returns the string length of the XML document being parsed
  • Access: public

[ Top ]

parse   [line 683]

void parse( string $data)

Start parsing some XML
  • Access: public

Parameters:

string   $data   —  XML document

[ Top ]

set_data_handler   [line 568]

void set_data_handler( string $data_method)

Sets the data handler method which deals with the contents of XML

elements.
The handler method must accept two arguments, the first being an instance of XML_HTMLSax3 and the second being the contents of an XML element e.g.

 function myDataHander(& $parser,$data){}


Parameters:

string   $data_method   —  name of method

[ Top ]

set_element_handler   [line 591]

void set_element_handler( string $opening_method, string $closing_method)

Sets the open and close tag handlers
The open handler method must accept three arguments; the parser, the tag name and an array of attributes e.g.

 function myOpenHander(& $parser,$tagname,$attrs=array()){}
The close handler method must accept two arguments; the parser and the tag name e.g.
 function myCloseHander(& $parser,$tagname){}


Parameters:

string   $opening_method   —  name of open method
string   $closing_method   —  name of close method

[ Top ]

set_escape_handler   [line 628]

void set_escape_handler( string $escape_method)

Sets the XML escape handler method e.g. for comments and doctype

declarations
The handler method must accept two arguments; the parser and the contents of the escaped section

 function myEscapeHander(& $parser, $data){}


Parameters:

string   $escape_method   —  name of method

[ Top ]

set_jasp_handler   [line 645]

void set_jasp_handler( string $jasp_method)

Sets the JSP/ASP markup handler

The handler method must accept two arguments; the parser and body of the JASP tag

 function myJaspHander(& $parser, $data){}


Parameters:

string   $jasp_method   —  name of method

[ Top ]

set_object   [line 506]

mixed set_object( object handler &$object)

Sets the user defined handler object. Returns a PEAR Error if supplied argument is not an object.
  • Access: public

Parameters:

object handler   &$object   —  object containing SAX callback methods

[ Top ]

set_option   [line 544]

boolean set_option( string $name, [int $value = 1])

Sets a parser option. By default all options are switched off.

Returns a PEAR Error if option is invalid
Available options:

  • XML_OPTION_TRIM_DATA_NODES: trim whitespace off the beginning and end of data passed to the data handler
  • XML_OPTION_LINEFEED_BREAK: linefeeds result in additional data handler calls
  • XML_OPTION_TAB_BREAK: tabs result in additional data handler calls
  • XML_OPTION_ENTITIES_UNPARSED: XML entities are returned as seperate data handler calls in unparsed form
  • XML_OPTION_ENTITIES_PARSED: (PHP 4.3.0+ only) XML entities are returned as seperate data handler calls and are parsed with PHP's html_entity_decode() function
  • XML_OPTION_STRIP_ESCAPES: strips out the -- -- comment markers or CDATA markup inside an XML escape, if found.
To get HTMLSax to behave in the same way as the native PHP SAX parser, using it's default state, you need to switch on XML_OPTION_LINEFEED_BREAK, XML_OPTION_ENTITIES_PARSED and XML_OPTION_CASE_FOLDING

  • Access: public

Parameters:

string   $name   —  name of parser option
int   $value   —  (optional) 1 to switch on, 0 for off

[ Top ]

set_pi_handler   [line 610]

void set_pi_handler( string $pi_method)

Sets the processing instruction handler method e.g. for PHP open

and close tags
The handler method must accept three arguments; the parser, the PI target and data inside the PI

 function myPIHander(& $parser,$target, $data){}


Parameters:

string   $pi_method   —  name of method

[ Top ]


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