Element#

class src.pyconverter.xml2py.ast_tree.Element(element, parse_children=True)#

Provides the base element.

Overview#

has_children

Return wether the element has children.

get

Get an item from an element.

print_tree

Print the tree.

types_repr

Return the string types.

get_children_by_type

Get children of a specific type.

get_titles_in_element_list

Get the titles of the elements in a list of elements.

to_rst

Return a string to enable converting the element to an RST format.

rec_find

Find the first type matching a given type string recursively.

find

Find the first type matching a given type string.

find_all

Find all types matching a given type string.

text_content

Text content.

raw

Raw string of the element.

tostring

Attributes of the element as a dictionary.

added

Has the revision flag added.

any_isalnum

Returns True if any characters are alphanumeric.

tail

Tail of the element as a string.

children

Children of the tree.

children_types

Types of the children.

title

Element title.

content

Text content.

id

ID of the element.

next_elem

Next element.

prev_elem

Previous element.

tag

Element tag.

Import detail#

from src.pyconverter.xml2py.ast_tree import Element

Property detail#

property Element.text_content#

Text content.

property Element.raw#

Raw string of the element.

property Element.tostring#

Attributes of the element as a dictionary.

property Element.added#

Has the revision flag added.

property Element.any_isalnum#

Returns True if any characters are alphanumeric.

property Element.tail#

Tail of the element as a string.

property Element.children#

Children of the tree.

property Element.children_types#

Types of the children.

property Element.title#

Element title.

property Element.content#

Text content.

property Element.id#

ID of the element.

property Element.next_elem#

Next element.

property Element.prev_elem#

Previous element.

property Element.tag#

Element tag.

Method detail#

Element.has_children()#

Return wether the element has children.

Element.get(entry)#

Get an item from an element.

Element.print_tree()#

Print the tree.

Element.types_repr()#

Return the string types.

Element.__getitem__(index)#
Element.__len__()#
Element.get_children_by_type(type_name)#

Get children of a specific type.

Element.get_titles_in_element_list()#

Get the titles of the elements in a list of elements.

Element.__repr__()#
Element.to_rst(indent='', max_length=100, links=None, base_url=None, fcache=None)#

Return a string to enable converting the element to an RST format.

Element.rec_find(_type, terms=None)#

Find the first type matching a given type string recursively.

Element.find(_type, terms=None)#

Find the first type matching a given type string.

Element.find_all(_type, recursive=False, terms=None)#

Find all types matching a given type string.