Class: progressive_parser - X-Ref
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 @progressive_parser_processor, 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 @progressive_parser_processor
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
set_progress(\core\progress\base $progress)
X-Ref
|
Sets the progress tracker for the parser. If set, the tracker will be
called to report indeterminate progress for each chunk of XML.
The caller should have already called start_progress on the progress tracker.
param: \core\progress\base $progress Progress tracker
|
dirname($path)
X-Ref
|
Provides one cross-platform dirname function for
handling parser paths, see MDL-24381
|