[ Index ] |
|
Code source de SPIP 1.8.3 |
[Code source] [Imprimer] [Statistiques]
Main parser components
Version: | $Id: HTMLSax3.php,v 1.1 2004/06/02 14:09:19 hfuecks Exp $ |
Poids: | 687 lignes (23 kb) |
Inclus ou requis: | 1 fois |
Référencé: | 0 fois |
Nécessite: | 2 fichiers ecrire/safehtml/classes/HTMLSax3/States.php ecrire/safehtml/classes/HTMLSax3/Decorators.php |
XML_HTMLSax3_StateParser:: (9 méthodes):
XML_HTMLSax3_StateParser()
unscanCharacter()
ignoreCharacter()
scanCharacter()
scanUntilString()
scanUntilCharacters()
ignoreWhitespace()
parse()
_parse()
XML_HTMLSax3_StateParser_Lt430:: (4 méthodes):
XML_HTMLSax3_StateParser_Lt430()
scanUntilCharacters()
ignoreWhitespace()
parse()
XML_HTMLSax3_StateParser_Gtet430:: (4 méthodes):
XML_HTMLSax3_StateParser_Gtet430()
scanUntilCharacters()
ignoreWhitespace()
parse()
XML_HTMLSax3_NullHandler:: (1 méthode):
DoNothing()
XML_HTMLSax3:: (11 méthodes):
XML_HTMLSax3()
set_object()
set_option()
set_data_handler()
set_element_handler()
set_pi_handler()
set_escape_handler()
set_jasp_handler()
get_current_position()
get_length()
parse()
Classe: XML_HTMLSax3_StateParser - X-Ref
Base State ParserXML_HTMLSax3_StateParser(& $htmlsax) X-Ref |
Constructs XML_HTMLSax3_StateParser setting up states |
unscanCharacter() X-Ref |
Moves the position back one character return: void |
ignoreCharacter() X-Ref |
Moves the position forward one character return: void |
scanCharacter() X-Ref |
Returns the next character from the XML document or void if at end return: mixed |
scanUntilString($string) X-Ref |
Returns a string from the current position to the next occurance of the supplied string param: string string to search until return: string |
scanUntilCharacters($string) X-Ref |
Returns a string from the current position until the first instance of one of the characters in the supplied string argument param: string string to search until return: string |
ignoreWhitespace() X-Ref |
Moves the position forward past any whitespace characters return: void |
parse($data) X-Ref |
Begins the parsing operation, setting up any decorators, depending on parse options invoking _parse() to execute parsing param: string XML document to parse return: void |
_parse($state = XML_HTMLSAX3_STATE_START) X-Ref |
Performs the parsing itself, delegating calls to a specific parser state param: constant state object to parse with return: void |
Classe: XML_HTMLSax3_StateParser_Lt430 - X-Ref
Parser for PHP Versions below 4.3.0. Uses a slower parsing mechanism thanXML_HTMLSax3_StateParser_Lt430(& $htmlsax) X-Ref |
Constructs XML_HTMLSax3_StateParser_Lt430 defining available parser options |
scanUntilCharacters($string) X-Ref |
Returns a string from the current position until the first instance of one of the characters in the supplied string argument param: string string to search until return: string |
ignoreWhitespace() X-Ref |
Moves the position forward past any whitespace characters return: void |
parse($data) X-Ref |
Begins the parsing operation, setting up the unparsed XML entities decorator if necessary then delegating further work to parent param: string XML document to parse return: void |
Classe: XML_HTMLSax3_StateParser_Gtet430 - X-Ref
Parser for PHP Versions equal to or greater than 4.3.0. Uses a fasterXML_HTMLSax3_StateParser_Gtet430(& $htmlsax) X-Ref |
Constructs XML_HTMLSax3_StateParser_Gtet430 defining available parser options |
scanUntilCharacters($string) X-Ref |
Returns a string from the current position until the first instance of one of the characters in the supplied string argument. param: string string to search until return: string |
ignoreWhitespace() X-Ref |
Moves the position forward past any whitespace characters return: void |
parse($data) X-Ref |
Begins the parsing operation, setting up the parsed and unparsed XML entity decorators if necessary then delegating further work to parent param: string XML document to parse return: void |
Classe: XML_HTMLSax3 - X-Ref
User interface class. All user calls should only be made to this classXML_HTMLSax3() X-Ref |
Constructs XML_HTMLSax3 selecting concrete StateParser subclass depending on PHP version being used as well as setting the default NullHandler for all callbacks<br /> <b>Example:</b> <pre> $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); </pre> |
set_object(&$object) X-Ref |
Sets the user defined handler object. Returns a PEAR Error if supplied argument is not an object. param: object handler object containing SAX callback methods return: mixed |
set_option($name, $value=1) X-Ref |
Sets a parser option. By default all options are switched off. Returns a PEAR Error if option is invalid<br /> <b>Available options:</b> <ul> <li>XML_OPTION_TRIM_DATA_NODES: trim whitespace off the beginning and end of data passed to the data handler</li> <li>XML_OPTION_LINEFEED_BREAK: linefeeds result in additional data handler calls</li> <li>XML_OPTION_TAB_BREAK: tabs result in additional data handler calls</li> <li>XML_OPTION_ENTITIES_UNPARSED: XML entities are returned as seperate data handler calls in unparsed form</li> <li>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</li> <li>XML_OPTION_STRIP_ESCAPES: strips out the -- -- comment markers or CDATA markup inside an XML escape, if found.</li> </ul> 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 param: string name of parser option param: int (optional) 1 to switch on, 0 for off return: boolean |
set_data_handler($data_method) X-Ref |
Sets the data handler method which deals with the contents of XML elements.<br /> 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. <pre> function myDataHander(& $parser,$data){} </pre> param: string name of method return: void |
set_element_handler($opening_method, $closing_method) X-Ref |
Sets the open and close tag handlers <br />The open handler method must accept three arguments; the parser, the tag name and an array of attributes e.g. <pre> function myOpenHander(& $parser,$tagname,$attrs=array()){} </pre> The close handler method must accept two arguments; the parser and the tag name e.g. <pre> function myCloseHander(& $parser,$tagname){} </pre> param: string name of open method param: string name of close method return: void |
set_pi_handler($pi_method) X-Ref |
Sets the processing instruction handler method e.g. for PHP open and close tags<br /> The handler method must accept three arguments; the parser, the PI target and data inside the PI <pre> function myPIHander(& $parser,$target, $data){} </pre> param: string name of method return: void |
set_escape_handler($escape_method) X-Ref |
Sets the XML escape handler method e.g. for comments and doctype declarations<br /> The handler method must accept two arguments; the parser and the contents of the escaped section <pre> function myEscapeHander(& $parser, $data){} </pre> param: string name of method return: void |
set_jasp_handler($jasp_method) X-Ref |
Sets the JSP/ASP markup handler<br /> The handler method must accept two arguments; the parser and body of the JASP tag <pre> function myJaspHander(& $parser, $data){} </pre> param: string name of method return: void |
get_current_position() X-Ref |
Returns the current string position of the "cursor" inside the XML document <br />Intended for use from within a user defined handler called via the $parser reference e.g. <pre> function myDataHandler(& $parser,$data) { echo( 'Current position: '.$parser->get_current_position() ); } </pre> return: int |
get_length() X-Ref |
Returns the string length of the XML document being parsed return: int |
parse($data) X-Ref |
Start parsing some XML param: string XML document return: void |
Généré le : Thu Feb 22 22:27:47 2007 | par Balluche grâce à PHPXref 0.7 |