wx.html.HtmlParser

Inheritance diagram for wx.html.HtmlParser:



Description

Classes derived from this handle the generic parsing of HTML documents: it scans the document and divide it into blocks of tags (where one block consists of beginning and ending tag and of text between these two tags).

It is independent from wx.html.HtmlWindow and can be used as stand-alone parser.

It uses system of tag handlers to parse the HTML document. Tag handlers are not statically shared by all instances but are created for each wx.html.HtmlParser instance. The reason is that the handler may contain document-specific temporary data used during parsing (e.g. complicated structures like tables).

Typically the user calls only the Parse method.

See also

wx.html.HtmlTag

Derived From

Known Subclasses

wx.html.HtmlWinParser

Properties Summary

Class API

Methods

__init__()
No docstrings available for this method.

AddTagHandler(handler)

Adds handler to the internal list (and hash table) of handlers. This method should not be called directly by user but rather by derived class’ constructor.

This adds the handler to this instance of wx.html.HtmlParser, not to all objects of this class! (Static front-end to AddTagHandler is provided by wx.html.HtmlWinParser).

All handlers are deleted on object deletion.

Parameters:


DoParsing(begin_pos, end_pos)

Parses the source from begin_pos to end_pos - 1.

Parameters:

  • begin_pos (int)
  • end_pos (int)

DoneParser()
This must be called after DoParsing.

GetFS()

Returns pointer to the file system.


Returns:

wx.FileSystem


GetInnerSource(tag)

Parameters:


Returns:

string


GetSource()

Returns pointer to the source being parsed.


Returns:

string


InitParser(source)

Setups the parser for parsing the source string. (Should be overridden in derived class).

Parameters:

  • source (string)

Parse(source)

Proceeds parsing of the document. This is end-user method. You can simply call it when you need to obtain parsed output (which is parser-specific).

Parameters:

  • source (string)

Returns:

wx.Object


PopTagHandler()
Restores parser’s state before last call to PushTagHandler.

PushTagHandler(handler, tags)

Forces the handler to handle additional tags.

The handler should already be added to this parser.

Parameters:


SetFS(fs)

Sets the virtual file system that will be used to request additional files. (For example <IMG> tag handler requests wx.FSFile with the image data.)

Parameters:


StopParsing()

Call this function to interrupt parsing from a tag handler. No more tags will be parsed afterward.

This function may only be called from Parse or any function called by it (i.e. from tag handlers).


Properties

FS
See GetFS and SetFS
Source
See GetSource