lxml
xsdata.formats.dataclass.parsers.handlers.lxml
LxmlEventHandler
Bases: XmlHandler
An lxml event handler.
Source code in xsdata/formats/dataclass/parsers/handlers/lxml.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
parse(source, ns_map)
Parse the source XML document.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
The xml source, can be a file resource or an input stream, or a lxml tree/element. |
required |
ns_map
|
dict[str | None, str]
|
A namespace prefix-URI recorder map |
required |
Returns:
| Type | Description |
|---|---|
Any
|
An instance of the class type representing the parsed content. |
Source code in xsdata/formats/dataclass/parsers/handlers/lxml.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
process_context(context, ns_map)
Iterate context and push events to main parser.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
Iterable[tuple[str, Any]]
|
The iterable lxml context |
required |
ns_map
|
dict[str | None, str]
|
A namespace prefix-URI recorder map |
required |
Returns:
| Type | Description |
|---|---|
Any
|
An instance of the class type representing the parsed content. |
Source code in xsdata/formats/dataclass/parsers/handlers/lxml.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |