Rest.XmlNode¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
attrs |
r/w |
a |
|
children |
r/w |
a |
|
content |
r/w |
the textual content of the element |
|
name |
r/w |
the name of the element |
|
next |
r/w |
the sibling |
|
ref_count |
r |
Methods¶
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Rest.XmlNode¶
The
Rest.XmlNode
contains a parsed XmlNode for easy consumption- add_attr(attribute, value)¶
-
Adds attribute to the given node.
- add_child(tag)¶
- Parameters:
tag (
str
) – name of the child node- Returns:
the newly added
Rest.XmlNode
; the node object is owned by, and valid for the life time of, the #RestXmlCreator.- Return type:
Adds a new node to the given parent node; to create the top-level node, parent should be
None
.
- find(tag)¶
- Parameters:
tag (
str
) – the name of a node- Returns:
the first child node, or
None
if it doesn’t exist.- Return type:
Searches for the first child node of self named tag.
- get_attr(attr_name)¶
- Parameters:
attr_name (
str
) – the name of an attribute- Returns:
the attribute value. This string is owned by
Rest.XmlNode
and should not be freed.- Return type:
Get the value of the attribute named attr_name, or
None
if it doesn’t exist.
- print_()¶
- Returns:
xml string representing the node.
- Return type:
Recursively outputs given node and it’s children.