GenericWrapper wrappes an lxml.Element object. If xmlnode is None a new node with elementname TAG will be created.
All output nodes are wrapped into GenericWrapper or a subclass of it and also all input nodes.
All wrapping classes are stored by the register_class() function in a central register. The wrap() function searches by the tag attribute of the lxml.Element for the appropriate wrapping class, calls this class cls(xmlnode=element) and returns the resulting object.
Tag name of the wrapped XML element (like <text:p>) in Clark Notation. To get the Clark Notation of an element use the xmlns.CN() function.
Reference to the lxml.Element object.
Get/Set the lxml.Element.text content as str.
Get/Set the lxml.Element.tail content as str.
Should return the length of the plaintext() result.
Get the class name as str. (eg. 'GenericWrapper' for this class)
Iterate over all child nodes, yields wrapped XML nodes.
Get count of child nodes.
Parameters: | index (int) – numeric index |
---|
Get wrapped XML child-node at position index.
Parameters: |
|
---|
Set child at position index to element.
Parameters: | index (int) – numeric index |
---|
Delete child at position index.
Parameters: | child (GenericWrapper) – wrapped XML node |
---|
Get numeric index of child as int.
Raises IndexError if child.xmlnode is not in self.xmlnode
Parameters: | child (GenericWrapper) – wrapped XML node |
---|
Parameters: | index (int) – numeric index |
---|---|
Returns: | wrapped XML node |
Get wrapped XML node at position index.
Parameters: |
|
---|
Parameters: | index (int) – numeric index |
---|
Remove XML node at position index.
Parameters: | tag (str) – tag name in Clark Notation |
---|
Find all subelements by xml-tag (in Clark Notation).
Parameters: | key (str) – keyname |
---|
Get attribute key of wrapped XML node, or default if key doesn’t exist.
Parameters: |
|
---|
Set attribute key of the wrapped XML node to value.
Parameters: | child (GenericWrapper) – append wrapped XML node |
---|
Append child as last child into the wrapped XML node.
Parameters: |
|
---|
Insert child before the target node target.
Parameters: | child (GenericWrapper) – wrapped XML node |
---|
Remove child from node.
Clear node content (text, tail, attributes) and remove all children.
Returns the plaintext representation of the node.