****************** wx.html.HtmlParser ****************** Inheritance diagram for `wx.html.HtmlParser`: | .. inheritance-diagram:: 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 <#Parse>`_ method. .. seealso:: `wx.html.HtmlTag `_ Derived From ^^^^^^^^^^^^^ * `wx.Object <../Widgets/wx.Object.html>`_ Known Subclasses ^^^^^^^^^^^^^^^^ `wx.html.HtmlWinParser `_ Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `AddTagHandler <#AddTagHandler>`_ * `DoParsing <#DoParsing>`_ * `DoneParser <#DoneParser>`_ * `GetFS <#GetFS>`_ * `GetInnerSource <#GetInnerSource>`_ * `GetSource <#GetSource>`_ * `InitParser <#InitParser>`_ * `Parse <#Parse>`_ * `PopTagHandler <#PopTagHandler>`_ * `PushTagHandler <#PushTagHandler>`_ * `SetFS <#SetFS>`_ * `StopParsing <#StopParsing>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `FS <#FS>`_ * `Source <#Source>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__() `No docstrings available for this method.` -------- .. 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:** * `handler` (`wx.html.HtmlTagHandler `_) -------- .. method:: DoParsing(begin_pos, end_pos) Parses the source from `begin_pos` to `end_pos` - 1. **Parameters:** * `begin_pos` (int) * `end_pos` (int) -------- .. method:: DoneParser() This must be called after `DoParsing <#DoParsing>`_. -------- .. method:: GetFS() Returns pointer to the file system. | **Returns:** `wx.FileSystem <../Widgets/wx.FileSystem.html>`_ -------- .. method:: GetInnerSource(tag) | **Parameters:** * `tag` (`wx.html.HtmlTag `_) | **Returns:** `string` -------- .. method:: GetSource() Returns pointer to the source being parsed. | **Returns:** `string` -------- .. method:: InitParser(source) Setups the parser for parsing the `source` string. (Should be overridden in derived class). **Parameters:** * `source` (string) -------- .. method:: 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 <../Widgets/wx.Object.html>`_ -------- .. method:: PopTagHandler() Restores parser's state before last call to `PushTagHandler <#PushTagHandler>`_. -------- .. method:: PushTagHandler(handler, tags) Forces the handler to handle additional tags. The handler should already be added to this parser. **Parameters:** * `handler` (`wx.html.HtmlTagHandler `_): the handler * `tags` (string): List of tags. The parser will redirect these tags to `handler` (until call to `PopTagHandler <#PopTagHandler>`_). -------- .. method:: SetFS(fs) Sets the virtual file system that will be used to request additional files. (For example ```` tag handler requests `wx.FSFile` with the image data.) **Parameters:** * `fs` (`wx.FileSystem <../Widgets/wx.FileSystem.html>`_) -------- .. method:: 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 <#Parse>`_ or any function called by it (i.e. from tag handlers). -------- Properties ^^^^^^^^^^ .. attribute:: FS See `GetFS <#GetFS>`_ and `SetFS <#SetFS>`_ .. attribute:: Source See `GetSource <#GetSource>`_