Page & Fragments
pagemodel.page
Page and fragment base classes.
BasePagerepresents an entire HTML/XML document.BaseFragment/HtmlFragmentrepresent a subtree within a document.StreamPageprovides iterative XML processing without loading the whole tree.
BaseFragment
Represents a subtree of a document.
| Parameters: |
|
|---|
source
cached
property
source
The serialised XML of this fragment's subtree.
BasePage
Main entry point for extracting data from an HTML/XML document.
Accepts a string, bytes, or pre‑parsed lxml.html.HtmlElement.
Fields declared on the class are automatically resolved via
_process_annotations.
| Parameters: |
|
|---|
doc
cached
property
doc
The parsed lxml document tree.
source
cached
property
source
The original HTML/XML source as a string.
HtmlFragment
Alias for BaseFragment – kept for backward compatibility.
StreamPage
Iterative XML processor that yields exported dictionaries.
Useful for large XML files where building a full DOM is expensive.
| Parameters: |
|
|---|
Methods:
iter_items
iter_items(tag)
Yield exported dictionaries for each occurrence of tag.