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

Public Member Functions

 __construct ($case_folding=false)
 set_file ($file)
 set_contents ($contents)
 set_processor ($processor)
 process ()

Static Public Member Functions

static dirname ($path)

Protected Member Functions

 parse ($data, $eof)
 publish ($data)
 inform_start ($path)
 inform_end ($path)
 postprocess_cdata ($data)
 start_tag ($parser, $tag, $attributes)
 end_tag ($parser, $tag)
 char_data ($parser, $data)

Protected Attributes

 $xml_parser
 $file
 $contents
 $procesor
 $level
 $path
 $accum
 $attrs
 $topush
 $prevlevel
 $currtag

Detailed Description

Class implementing one SAX progressive push parser.

SAX parser able to process XML content from files/variables. It supports attributes and case folding and works only with UTF-8 content. It's one progressive push parser because, intead of loading big crunchs of information in memory, it "publishes" (pushes) small information in a "propietary array format" througt the corresponding , that will be the responsibe for returning information into handy formats to higher levels.

Note that, while this progressive parser is able to process any XML file, it is 100% progressive so it publishes the information in the original order it's parsed (that's the expected behaviour) so information belonging to the same path can be returned in different chunks if there are inner levels/paths in the middle. Be warned!

The "propietary array format" that the parser publishes to the is this: array ( 'path' => path where the tags belong to, 'level'=> level (1-based) of the tags 'tags => array ( 'name' => name of the tag, 'attrs'=> array( name of the attr => value of the attr), 'cdata => cdata of the tag ) )

TODO: Finish phpdocs

Definition at line 54 of file progressive_parser.class.php.


Constructor & Destructor Documentation

__construct ( case_folding = false)

Definition at line 70 of file progressive_parser.class.php.


Member Function Documentation

char_data ( parser,
data 
) [protected]

Definition at line 270 of file progressive_parser.class.php.

static dirname ( path) [static]

Provides one cross-platform dirname function for handling parser paths, see MDL-24381

Definition at line 151 of file progressive_parser.class.php.

Here is the caller graph for this function:

end_tag ( parser,
tag 
) [protected]

Definition at line 236 of file progressive_parser.class.php.

Here is the call graph for this function:

inform_end ( path) [protected]

Inform to the processor that we have finished parsing one path

Definition at line 182 of file progressive_parser.class.php.

Here is the caller graph for this function:

inform_start ( path) [protected]

Inform to the processor that we have started parsing one path

Definition at line 175 of file progressive_parser.class.php.

Here is the caller graph for this function:

parse ( data,
eof 
) [protected]

Definition at line 157 of file progressive_parser.class.php.

Here is the caller graph for this function:

postprocess_cdata ( data) [protected]

Definition at line 186 of file progressive_parser.class.php.

Here is the caller graph for this function:

process ( )

Definition at line 124 of file progressive_parser.class.php.

Here is the call graph for this function:

publish ( data) [protected]

Definition at line 168 of file progressive_parser.class.php.

Here is the caller graph for this function:

set_contents ( contents)

Definition at line 103 of file progressive_parser.class.php.

set_file ( file)

Definition at line 92 of file progressive_parser.class.php.

set_processor ( processor)

Definition at line 114 of file progressive_parser.class.php.

start_tag ( parser,
tag,
attributes 
) [protected]

Definition at line 190 of file progressive_parser.class.php.

Here is the call graph for this function:


Field Documentation

$accum [protected]

Definition at line 63 of file progressive_parser.class.php.

$attrs [protected]

Definition at line 64 of file progressive_parser.class.php.

$contents [protected]

Definition at line 58 of file progressive_parser.class.php.

$currtag [protected]

Definition at line 68 of file progressive_parser.class.php.

$file [protected]

Definition at line 57 of file progressive_parser.class.php.

$level [protected]

Definition at line 61 of file progressive_parser.class.php.

$path [protected]

Definition at line 62 of file progressive_parser.class.php.

$prevlevel [protected]

Definition at line 67 of file progressive_parser.class.php.

$procesor [protected]

Definition at line 59 of file progressive_parser.class.php.

$topush [protected]

Definition at line 66 of file progressive_parser.class.php.

$xml_parser [protected]

Definition at line 56 of file progressive_parser.class.php.


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