Creates a arbitrary element and is intended to be subclassed not used on its own. More...
Public Member Functions | |
def | __init__ |
def | get_knownns |
Odfpy maintains a list of known namespaces. More... | |
def | get_nsprefix |
Odfpy maintains a list of known namespaces. More... | |
def | allowed_attributes |
def | addElement |
adds an element to an Element More... | |
def | addText |
Adds text to an element Setting check_grammar=False turns off grammar checking. More... | |
def | addCDATA |
Adds CDATA to an element Setting check_grammar=False turns off grammar checking. More... | |
def | removeAttribute |
Removes an attribute by name. More... | |
def | setAttribute |
Add an attribute to the element This is sort of a convenience method. More... | |
def | setAttrNS |
Add an attribute to the element In case you need to add an attribute the library doesn't know about then you must provide the full qualified name It will not check that the attribute is legal according to the schema. More... | |
def | getAttrNS |
gets an attribute, given a namespace and a key More... | |
def | removeAttrNS |
def | getAttribute |
Get an attribute value. More... | |
def | write_open_tag |
def | write_close_tag |
def | toXml |
Generate an XML stream out of the tree structure. More... | |
def | getElementsByType |
Gets elements based on the type, which is function from text.py, draw.py etc. More... | |
def | isInstanceOf |
This is a check to see if the object is an instance of a type. More... | |
![]() | |
def | hasChildNodes |
Tells whether this element has any children; text nodes, subelements, whatever. More... | |
def | insertBefore |
Inserts the node newChild before the existing child node refChild. More... | |
def | appendChild |
Adds the node newChild to the end of the list of children of this node. More... | |
def | removeChild |
Removes the child node indicated by oldChild from the list of children, and returns it. More... | |
def | __str__ |
def | __unicode__ |
Public Attributes | |
qname | |
ownerDocument | |
childNodes | |
allowed_children | |
tagName | |
attributes | |
Static Public Attributes | |
nodeType = Node.ELEMENT_NODE | |
dictionary | namespaces = {} |
![]() | |
parentNode = None | |
nextSibling = None | |
previousSibling = None | |
Creates a arbitrary element and is intended to be subclassed not used on its own.
This element is the base of every element it defines a class which resembles a xml-element. The main advantage of this kind of implementation is that you don't have to create a toXML method for every different object. Every element consists of an attribute, optional subelements, optional text and optional cdata.
Definition at line 299 of file element.py.
def odf.element.Element.__init__ | ( | self, | |
attributes = None , |
|||
text = None , |
|||
cdata = None , |
|||
qname = None , |
|||
qattributes = None , |
|||
check_grammar = True , |
|||
args | |||
) |
Definition at line 311 of file element.py.
def odf.element.Element.addCDATA | ( | self, | |
cdata, | |||
check_grammar = True |
|||
) |
Adds CDATA to an element Setting check_grammar=False turns off grammar checking.
Definition at line 411 of file element.py.
def odf.element.Element.addElement | ( | self, | |
element, | |||
check_grammar = True |
|||
) |
adds an element to an Element
Element.addElement(Element)
Definition at line 387 of file element.py.
def odf.element.Element.addText | ( | self, | |
text, | |||
check_grammar = True |
|||
) |
Adds text to an element Setting check_grammar=False turns off grammar checking.
Definition at line 400 of file element.py.
def odf.element.Element.allowed_attributes | ( | self | ) |
Definition at line 374 of file element.py.
def odf.element.Element.get_knownns | ( | self, | |
prefix | |||
) |
Odfpy maintains a list of known namespaces.
In some cases a prefix is used, and we need to know which namespace it resolves to.
Definition at line 357 of file element.py.
def odf.element.Element.get_nsprefix | ( | self, | |
namespace | |||
) |
Odfpy maintains a list of known namespaces.
In some cases we have a namespace URL, and needs to look up or assign the prefix for it.
Definition at line 367 of file element.py.
def odf.element.Element.getAttribute | ( | self, | |
attr | |||
) |
Get an attribute value.
The method knows which namespace the attribute is in
Definition at line 503 of file element.py.
def odf.element.Element.getAttrNS | ( | self, | |
namespace, | |||
localpart | |||
) |
gets an attribute, given a namespace and a key
namespace | a unicode string or a bytes: the namespace |
localpart | a unicode string or a bytes: the key to get the attribute |
Definition at line 484 of file element.py.
def odf.element.Element.getElementsByType | ( | self, | |
element | |||
) |
Gets elements based on the type, which is function from text.py, draw.py etc.
Definition at line 562 of file element.py.
def odf.element.Element.isInstanceOf | ( | self, | |
element | |||
) |
This is a check to see if the object is an instance of a type.
Definition at line 568 of file element.py.
def odf.element.Element.removeAttribute | ( | self, | |
attr, | |||
check_grammar = True |
|||
) |
Removes an attribute by name.
Definition at line 419 of file element.py.
def odf.element.Element.removeAttrNS | ( | self, | |
namespace, | |||
localpart | |||
) |
def odf.element.Element.setAttribute | ( | self, | |
attr, | |||
value, | |||
check_grammar = True |
|||
) |
Add an attribute to the element This is sort of a convenience method.
All attributes in ODF have namespaces. The library knows what attributes are legal and then allows the user to provide the attribute as a keyword argument and the library will add the correct namespace. Must overwrite, If attribute already exists.
Definition at line 443 of file element.py.
def odf.element.Element.setAttrNS | ( | self, | |
namespace, | |||
localpart, | |||
value | |||
) |
Add an attribute to the element In case you need to add an attribute the library doesn't know about then you must provide the full qualified name It will not check that the attribute is legal according to the schema.
Must overwrite, If attribute already exists.
Definition at line 466 of file element.py.
def odf.element.Element.toXml | ( | self, | |
level, | |||
f | |||
) |
Generate an XML stream out of the tree structure.
level | integer: level in the XML tree; zero at root of the tree |
f | an open writable file able to accept unicode strings |
Definition at line 536 of file element.py.
def odf.element.Element.write_close_tag | ( | self, | |
level, | |||
f | |||
) |
Definition at line 527 of file element.py.
def odf.element.Element.write_open_tag | ( | self, | |
level, | |||
f | |||
) |
odf.element.Element.allowed_children |
Definition at line 317 of file element.py.
odf.element.Element.attributes |
Definition at line 328 of file element.py.
odf.element.Element.childNodes |
Definition at line 316 of file element.py.
|
static |
Definition at line 302 of file element.py.
|
static |
Definition at line 301 of file element.py.
odf.element.Element.ownerDocument |
Definition at line 315 of file element.py.
odf.element.Element.qname |
Definition at line 313 of file element.py.
odf.element.Element.tagName |
Definition at line 319 of file element.py.