Moodle  2.2.1
http://www.collinsharper.com
SimpleHtmlSaxParser Class Reference

Public Member Functions

 SimpleHtmlSaxParser (&$listener)
 parse ($raw)
 acceptStartToken ($token, $event)
 acceptEndToken ($token, $event)
 acceptAttributeToken ($token, $event)
 acceptEntityToken ($token, $event)
 acceptTextToken ($token, $event)
 ignore ($token, $event)

Static Public Member Functions

createLexer (&$parser)
 decodeHtml ($html)
 normalise ($html)

Data Fields

 $_lexer
 $_listener
 $_tag
 $_attributes
 $_current_attribute

Detailed Description

Definition at line 543 of file parser.php.


Member Function Documentation

acceptAttributeToken ( token,
event 
)

Part of the tag data.

Parameters:
string$tokenIncoming characters.
integer$eventLexer event type.
Returns:
boolean False if parse error. public

Definition at line 639 of file parser.php.

Here is the call graph for this function:

acceptEndToken ( token,
event 
)

Accepts a token from the end tag mode. The element name is converted to lower case.

Parameters:
string$tokenIncoming characters.
integer$eventLexer event type.
Returns:
boolean False if parse error. public

Definition at line 625 of file parser.php.

acceptEntityToken ( token,
event 
)

A character entity.

Parameters:
string$tokenIncoming characters.
integer$eventLexer event type.
Returns:
boolean False if parse error. public

Definition at line 660 of file parser.php.

acceptStartToken ( token,
event 
)

Accepts a token from the tag mode. If the starting element completes then the element is dispatched and the current attributes set back to empty. The element or attribute name is converted to lower case.

Parameters:
string$tokenIncoming characters.
integer$eventLexer event type.
Returns:
boolean False if parse error. public

Definition at line 597 of file parser.php.

Here is the call graph for this function:

acceptTextToken ( token,
event 
)

Character data between tags regarded as important.

Parameters:
string$tokenIncoming characters.
integer$eventLexer event type.
Returns:
boolean False if parse error. public

Definition at line 671 of file parser.php.

& createLexer ( &$  parser) [static]

Sets up the matching lexer. Starts in 'text' mode.

Parameters:
SimpleSaxParser$parserEvent generator, usually $self.
Returns:
SimpleLexer Lexer suitable for this parser. public

Definition at line 581 of file parser.php.

Here is the caller graph for this function:

decodeHtml ( html) [static]

Decodes any HTML entities.

Parameters:
string$htmlIncoming HTML.
Returns:
string Outgoing plain text. public

Definition at line 693 of file parser.php.

Here is the caller graph for this function:

ignore ( token,
event 
)

Incoming data to be ignored.

Parameters:
string$tokenIncoming characters.
integer$eventLexer event type.
Returns:
boolean False if parse error. public

Definition at line 682 of file parser.php.

normalise ( html) [static]

Turns HTML into text browser visible text. Images are converted to their alt text and tags are supressed. Entities are converted to their visible representation.

Parameters:
string$htmlHTML to convert.
Returns:
string Plain text. public

Definition at line 706 of file parser.php.

Here is the call graph for this function:

Here is the caller graph for this function:

parse ( raw)

Runs the content through the lexer which should call back to the acceptors.

Parameters:
string$rawPage text to parse.
Returns:
boolean False if parse error. public

Definition at line 570 of file parser.php.

SimpleHtmlSaxParser ( &$  listener)

Sets the listener.

Parameters:
SimpleSaxListener$listenerSAX event handler. public

Definition at line 555 of file parser.php.

Here is the call graph for this function:


Field Documentation

$_attributes

Definition at line 547 of file parser.php.

$_current_attribute

Definition at line 548 of file parser.php.

$_lexer

Definition at line 544 of file parser.php.

$_listener

Definition at line 545 of file parser.php.

$_tag

Definition at line 546 of file parser.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations