Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper Class Reference

List of all members.

Public Member Functions

def __getitem__
 attributes of the current node can be accessed via key operator
def __init__
def __setitem__
def __str__
def appendChild
def clearNodeCache
def cloneNode
def getAbsUrl
def getAttribute
def getAttributeDict
def getAttributeList
def getAttributeOrDefault
def getBaseUrl
def getChildren
def getChildrenNS
def getChildrenWithKey
def getCurrentNamespaces
def getElementsByTagName
def getElementsByTagNameNS
def getElementValue
def getElementValueFragments
def getEndLineNumber
def getFilePath
def getFirstChild
def getFirstChildNS
def getFirstChildWithKey
def getIterator
def getLocalName
def getLocation
def getNamespace
def getNamespaceURI
def getNsName
def getNsPrefix
def getParentNode
def getPrefix
def getQName
def getQNameAttribute
def getStartLineNumber
def getTagName
def getXPath
def getXPathList
def hasAttribute
def insertBefore
def insertSubtree
def isUsedByExternalCache
def nsName2QName
def printNode
def processWsAttribute
def processWsElementValue
def qName2NsName
def removeAttribute
def removeChild
def replaceChildBySubtree
def setAttribute
def setAttributeDefault
def setElementValue
def setExternalCacheUsage
def unlink

Public Attributes

 absUrl
 attributeSequence
 baseUrl
 curNs
 element
 endLineNumber
 filePath
 nodeUsedByExternalCache
 startLineNumber
 treeWrapper

Private Member Functions

def __clearChildrenCache
def __createElement
 PRIVATE methods.
def __updateAttrMaxLengthDict
def __useCaching

Private Attributes

 __childrenCache
 __firstChildCache
 __localNameCache
 __nsNameCache
 __nsUriCache
 __qNameAttrCache

Detailed Description

XML element wrapper API.

Contains a XML element node
All not implemented methods have to be overloaded by the derived class!!

Definition at line 263 of file xmlifApi.py.


Constructor & Destructor Documentation

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.__init__ (   self,
  element,
  treeWrapper,
  curNs = [],
  initAttrSeq = 1 
)
Constructor of wrapper class XmlElementWrapper.

Input parameter:
    element:       XML element node which is wrapped by this object
    treeWrapper:   XML tree wrapper class the current element belongs to
    curNs:         namespaces for scope of this element

Definition at line 270 of file xmlifApi.py.


Member Function Documentation

Clear children cache.

Definition at line 1274 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.__createElement (   self,
  tupleOrLocalName,
  attributeDict 
) [private]

PRIVATE methods.

Create a new ElementWrapper object.

Input parameter:
    tupleOrLocalName: tuple '(namespace, localName)' or 'localName' if no namespace is used
    attributeDict:    dictionary which contains the attributes and their values of the element node to be created
Returns the created ElementWrapper object

Definition at line 1247 of file xmlifApi.py.

attributes of the current node can be accessed via key operator

Attributes of the contained element node can be accessed via key operator.

Input parameter:
    tupleOrAttrName: name of the attribute (tuple of namespace and attributeName or only attributeName)
Returns the attribute value.

Definition at line 359 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.__setitem__ (   self,
  tupleOrAttrName,
  attributeValue 
)
Attributes of the contained element node can be accessed via key operator.

Input parameter:
    tupleOrAttrName: name of the attribute (tuple of namespace and attributeName or only attributeName)
    attributeValue:  attribute value to be set

Definition at line 373 of file xmlifApi.py.

Retrieve the textual representation of the contained element node.

Definition at line 454 of file xmlifApi.py.

Update dictionary which contains the maximum length of node attributes.

Used for pretty print to align the attributes of child nodes.
attrMaxLengthDict is in/out parameter.

Definition at line 1260 of file xmlifApi.py.

Definition at line 1288 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.appendChild (   self,
  tupleOrLocalNameOrElement,
  attributeDict = {} 
)
Append an element node to the children of the current node.

Input parameter:
    tupleOrLocalNameOrElement: (namespace, localName) or tagName or ElementWrapper object of the new child
    attributeDict:             attribute dictionary containing the attributes of the new child (optional)
If not an ElementWrapper object is given, a new ElementWrapper object is created with tupleOrLocalName
Returns the ElementWrapper object of the new child.

Definition at line 709 of file xmlifApi.py.

Clear all caches used by this element wrapper which contains element wrapper references.

Definition at line 330 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.cloneNode (   self,
  deep,
  cloneCallback = None 
)
Create a copy of the current element wrapper.
   The reference to the parent node is set to None!

Definition at line 308 of file xmlifApi.py.

Retrieve the absolute URL of the XML file the current element node belongs to.

Returns the absolute URL of the XML file the current element node belongs to.

Definition at line 998 of file xmlifApi.py.

Retrieve an attribute value of the current element node.

Input parameter:
    tupleOrAttrName:  tuple '(namespace, attributeName)' or 'attributeName' if no namespace is used
Returns the value of the specified attribute.

Definition at line 808 of file xmlifApi.py.

Retrieve a dictionary containing all attributes of the current element node.

Returns a dictionary (copy) containing all attributes of the current element node.

Definition at line 789 of file xmlifApi.py.

Retrieve a list containing all attributes of the current element node
   in the sequence specified in the input XML file.

Returns a list (copy) containing all attributes of the current element node
in the sequence specified in the input XML file (TODO: does currently not work for 4DOM/pyXML interface).

Definition at line 797 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.getAttributeOrDefault (   self,
  tupleOrAttrName,
  defaultValue 
)
Retrieve an attribute value of the current element node or the given default value if the attribute doesn't exist.

Input parameter:
    tupleOrAttrName:  tuple '(namespace, attributeName)' or 'attributeName' if no namespace is used
Returns the value of the specified attribute or the given default value if the attribute doesn't exist.

Definition at line 819 of file xmlifApi.py.

Retrieve the base URL of the XML file the current element node belongs to.

Returns the base URL of the XML file the current element node belongs to.

Definition at line 1006 of file xmlifApi.py.

Retrieve the ElementWrapper objects of the children element nodes.

Input parameter:
    tagFilter: retrieve only the children with this tag name ('*' or None returns all children)
Returns all children of this element node which match 'tagFilter' (list)

Definition at line 544 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.getChildrenNS (   self,
  namespaceURI,
  tagFilter = None 
)
Retrieve the ElementWrapper objects of the children element nodes using a namespace.

Input parameter:
    namespaceURI: the namespace URI of the children or None
    tagFilter:    retrieve only the children with this localName ('*' or None returns all children)
Returns all children of this element node which match 'namespaceURI' and 'tagFilter' (list)

Definition at line 569 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.getChildrenWithKey (   self,
  tagFilter = None,
  keyAttr = None,
  keyValue = None 
)
Retrieve the ElementWrapper objects of the children element nodes.

Input parameter:
    tagFilter: retrieve only the children with this tag name ('*' or None returns all children)
    keyAttr:   name of the key attribute
    keyValue:  value of the key
Returns all children of this element node which match 'tagFilter' (list)

Definition at line 580 of file xmlifApi.py.

Retrieve the namespace prefixes visible for the current element node

Returns a list of the namespace prefixes visible for the current node.

Definition at line 1039 of file xmlifApi.py.

Retrieve all descendant ElementWrapper object of current node whose tag name match 'tagFilter'.

Input parameter:
    tagFilter: retrieve only the children with this tag name ('*' or None returns all descendants)
Returns all descendants of this element node which match 'tagFilter' (list)

Definition at line 655 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.getElementsByTagNameNS (   self,
  namespaceURI,
  tagFilter = None 
)
Retrieve all descendant ElementWrapper object of current node whose tag name match 'namespaceURI' and 'tagFilter'.

Input parameter:
    namespaceURI: the namespace URI of the descendants or None
    tagFilter:    retrieve only the descendants with this localName ('*' or None returns all descendants)
Returns all descendants of this element node which match 'namespaceURI' and 'tagFilter' (list)

Definition at line 676 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.getElementValue (   self,
  ignoreEmtpyStringFragments = 0 
)
Retrieve the content of the current element node.

Returns the content of the current element node as string.
The content of multiple text nodes / CDATA nodes are concatenated to one string.

Input parameter:
    ignoreEmtpyStringFragments:   if 1, text nodes containing only whitespaces are ignored

Definition at line 931 of file xmlifApi.py.

Retrieve the content of the current element node as value fragment list.

Returns the content of the current element node as list of string fragments.
Each list element represents one text nodes / CDATA node.

Input parameter:
    ignoreEmtpyStringFragments:   if 1, text nodes containing only whitespaces are ignored

Method has to be implemented by derived classes!

Definition at line 943 of file xmlifApi.py.

Retrieve the end line number of the current element node.

Returns the end line number of the current element node in the XML file

Definition at line 990 of file xmlifApi.py.

Retrieve the file path of the XML file the current element node belongs to.

Returns the file path of the XML file the current element node belongs to.

Definition at line 1014 of file xmlifApi.py.

Retrieve the ElementWrapper objects of the first child element node.

Input parameter:
    tagFilter: retrieve only the first child with this tag name ('*' or None: no filter)
Returns the first child of this element node which match 'tagFilter'
or None if no suitable child element was found

Definition at line 593 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.getFirstChildNS (   self,
  namespaceURI,
  tagFilter = None 
)
Retrieve the ElementWrapper objects of the first child element node using a namespace.

Input parameter:
    namespaceURI: the namespace URI of the children or None
    tagFilter:    retrieve only the first child with this localName ('*' or None: no filter)
Returns the first child of this element node which match 'namespaceURI' and 'tagFilter'
or None if no suitable child element was found

Definition at line 626 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.getFirstChildWithKey (   self,
  tagFilter = None,
  keyAttr = None,
  keyValue = None 
)
Retrieve the ElementWrapper objects of the children element nodes.

Input parameter:
    tagFilter: retrieve only the children with this tag name ('*' or None returns all children)
    keyAttr:   name of the key attribute
    keyValue:  value of the key
Returns all children of this element node which match 'tagFilter' (list)

Definition at line 638 of file xmlifApi.py.

Creates a tree iterator.  The iterator loops over this element
   and all subelements, in document order, and returns all elements
   whose tag name match 'tagFilter'.

Input parameter:
    tagFilter: retrieve only the children with this tag name ('*' or None returns all descendants)
Returns all element nodes which match 'tagFilter' (list)

Definition at line 687 of file xmlifApi.py.

Retrieve the local name (without namespace) of the contained element node

Returns the local name (without namespace) of the contained element node

Definition at line 393 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.getLocation (   self,
  end = 0,
  fullpath = 0 
)
Retrieve a string containing file name and line number of the current element node.

Input parameter:
    end:      1 if end line number shall be shown, 0 for start line number
    fullpath: 1 if the full path of the XML file shall be shown, 0 for only the file name
Returns a string containing file name and line number of the current element node.
(e.g. to be used for traces or error messages)

Definition at line 1022 of file xmlifApi.py.

Retrieve namespace for a qName 'prefix:localName'.

Input parameter:
    qName:         qName 'prefix:localName'
Returns the corresponding namespace for the prefix of 'qName'.

Definition at line 1084 of file xmlifApi.py.

Retrieve the namespace URI of the contained element node

Returns the namespace URI of the contained element node (None if no namespace is used).

Definition at line 408 of file xmlifApi.py.

Retrieve a tuple (namespace, localName) of the contained element node

Returns a tuple (namespace, localName) of the contained element node (namespace is None if no namespace is used).

Definition at line 422 of file xmlifApi.py.

Retrieve prefix for a tuple '(namespace, localName)'.

Input parameter:
    nsLocalName:     tuple '(namespace, localName)'
Returns the corresponding prefix for the namespace of 'nsLocalName'.

Definition at line 1107 of file xmlifApi.py.

Retrieve the ElementWrapper object of the parent element node.

Returns the ElementWrapper object of the parent element node.

Definition at line 529 of file xmlifApi.py.

Retrieve the namespace prefix of the contained element node

Returns the namespace prefix of the contained element node (None if no namespace is used).

Definition at line 444 of file xmlifApi.py.

Retrieve a string prefix and localName of the contained element node

Returns a string "prefix:localName" of the contained element node

Definition at line 436 of file xmlifApi.py.

Retrieve a QName attribute value of the current element node.

Input parameter:
    tupleOrAttrName:  tuple '(namespace, attributeName)' or 'attributeName' if no namespace is used
Returns the value of the specified QName attribute as tuple (namespace, localName),
i.e. the prefix is converted into the corresponding namespace value.

Definition at line 832 of file xmlifApi.py.

Retrieve the start line number of the current element node.

Returns the start line number of the current element node in the XML file

Definition at line 982 of file xmlifApi.py.

Retrieve the (complete) tag name of the contained element node

Returns the (complete) tag name of the contained element node

Definition at line 385 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.getXPath (   self,
  xPath,
  namespaceRef = None,
  useDefaultNs = 1,
  attrIgnoreList = [] 
)
Retrieve node list or attribute list for specified XPath

Input parameter:
    xPath:           string containing xPath specification
    namespaceRef:    scope for namespaces (default is own element node)
    useDefaultNs:    1, if default namespace shall be used if no prefix is available
    attrIgnoreList:  list of attributes to be ignored if wildcard is specified for attributes

Returns all nodes which match xPath specification or
list of attribute values if xPath specifies an attribute

Definition at line 1127 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.getXPathList (   self,
  xPath,
  namespaceRef = None,
  useDefaultNs = 1,
  attrIgnoreList = [] 
)
Retrieve node list or attribute list for specified XPath

Input parameter:
    xPath:           string containing xPath specification
    namespaceRef:    scope for namespaces (default is own element node)
    useDefaultNs:    1, if default namespace shall be used if no prefix is available
    attrIgnoreList:  list of attributes to be ignored if wildcard is specified for attributes

Returns tuple (completeChildList, attrNodeList, attrNsNameFirst).
completeChildList: contains all child node which match xPath specification or
           list of attribute values if xPath specifies an attribute
attrNodeList:      contains all child nodes where the specified attribute was found
attrNsNameFirst:   contains the name of the first attribute which was found
TODO: Re-design namespace and attribute handling of this method

Definition at line 1142 of file xmlifApi.py.

Checks if the requested attribute exist for the current element node.

Returns 1 if the attribute exists, otherwise 0.

Definition at line 851 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.insertBefore (   self,
  tupleOrLocalNameOrElement,
  refChild,
  attributeDict = {} 
)
Insert an child element node before the given reference child of the current node.

Input parameter:
    tupleOrLocalNameOrElement: (namespace, localName) or tagName or ElementWrapper object of the new child
    refChild:                  reference child ElementWrapper object
    attributeDict:             attribute dictionary containing the attributes of the new child (optional)
If not an ElementWrapper object is given, a new ElementWrapper object is created with tupleOrLocalName
Returns the ElementWrapper object of the new child.

Definition at line 727 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.insertSubtree (   self,
  refChildWrapper,
  subTreeWrapper,
  insertSubTreeRootNode = 1 
)
Insert the given subtree before 'refChildWrapper' ('refChildWrapper' is not removed!)

Input parameter:
    refChildWrapper:       reference child ElementWrapper object
    subTreeWrapper:        subtree wrapper object which contains the subtree to be inserted
    insertSubTreeRootNode: if 1, root node of subtree is inserted into parent tree, otherwise not

Definition at line 759 of file xmlifApi.py.

Check if this node is used by an external cache.
   unlink commands are ignored if used by an external cache

Definition at line 335 of file xmlifApi.py.

Convert a tuple '(namespace, localName)' to a string 'prefix:localName'

Input parameter:
    nsLocalName:   tuple '(namespace, localName)' to be converted
Returns the corresponding string 'prefix:localName' for 'nsLocalName'.

Definition at line 1072 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.printNode (   self,
  indent = "",
  deep = 0,
  prettyPrint = 0,
  attrMaxLengthDict = {},
  printElementValue = 1,
  encoding = None 
)
Retrieve the textual representation of the contained element node.

Input parameter:
    indent:             indentation to be used for string representation
    deep:               0 or 1: controls if the child element nodes are also printed
    prettyPrint:        aligns the columns of the attributes of childNodes
    attrMaxLengthDict:  dictionary containing the length of the attribute values (used for prettyprint)
    printElementValue:  0 or 1: controls if the element value is printed
Returns the string representation

Definition at line 459 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.processWsAttribute (   self,
  tupleOrAttrName,
  wsAction 
)
Process white space action for the specified attribute according to requested 'wsAction'.

Input parameter:
    tupleOrAttrName:  tuple '(namespace, attributeName)' or 'attributeName' if no namespace is used
    wsAction:         'collapse':  substitute multiple whitespace characters by a single ' '
              'replace':   substitute each whitespace characters by a single ' '

Definition at line 914 of file xmlifApi.py.

Process white space action for the content of the current element node according to requested 'wsAction'.

Input parameter:
    wsAction:         'collapse':  substitute multiple whitespace characters by a single ' '
              'replace':   substitute each whitespace characters by a single ' '

Definition at line 968 of file xmlifApi.py.

Convert a qName 'prefix:localName' to a tuple '(namespace, localName)'.

Input parameter:
    qName:         qName to be converted
    useDefaultNs:  1 if default namespace shall be used
Returns the corresponding tuple '(namespace, localName)' for 'qName'.

Definition at line 1047 of file xmlifApi.py.

Removes an attribute from the current element node. 
No exception is raised if there is no matching attribute.
       
Input parameter:
    tupleOrAttrName:  tuple '(namespace, attributeName)' or 'attributeName' if no namespace is used

Definition at line 898 of file xmlifApi.py.

Remove the given child element node from the children of the current node.

Input parameter:
    childElementWrapper:  ElementWrapper object to be removed

Definition at line 749 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.replaceChildBySubtree (   self,
  childElementWrapper,
  subTreeWrapper,
  insertSubTreeRootNode = 1 
)
Replace child element node by XML subtree (e.g. expanding included XML files)

Input parameter:
    childElementWrapper:   ElementWrapper object to be replaced
    subTreeWrapper:        XML subtree wrapper object to  be inserted
    insertSubTreeRootNode: if 1, root node of subtree is inserted into parent tree, otherwise not

Definition at line 775 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.setAttribute (   self,
  tupleOrAttrName,
  attributeValue 
)
Sets an attribute value of the current element node. 
If the attribute does not yet exist, it will be created.
       
Input parameter:
    tupleOrAttrName:  tuple '(namespace, attributeName)' or 'attributeName' if no namespace is used
    attributeValue:   attribute value to be set

Definition at line 864 of file xmlifApi.py.

def pymavlink.generator.lib.genxmlif.xmlifApi.XmlElementWrapper.setAttributeDefault (   self,
  tupleOrAttrName,
  defaultValue 
)
Create attribute and set value to default if it does not yet exist for the current element node. 
If the attribute is already existing nothing is done.
       
Input parameter:
    tupleOrAttrName:  tuple '(namespace, attributeName)' or 'attributeName' if no namespace is used
    defaultValue:     default attribute value to be set

Definition at line 886 of file xmlifApi.py.

Set the content of the current element node.

Input parameter:
    elementValue:   string containing the new element value
If multiple text nodes / CDATA nodes are existing, 'elementValue' is set 
for the first text node / CDATA node. All other text nodes /CDATA nodes are set to ''. 

Definition at line 957 of file xmlifApi.py.

Set external cache usage for this node and its children
   unlink commands are ignored if used by an external cache

   Input parameter:
       used:       0 or 1 (used by external cache)
       deep:       0 or 1: controls if the child elements are also marked as used by external cache

Definition at line 341 of file xmlifApi.py.

Break circular references of this element and its children.

Definition at line 300 of file xmlifApi.py.


Member Data Documentation

Definition at line 276 of file xmlifApi.py.

Definition at line 276 of file xmlifApi.py.

Definition at line 396 of file xmlifApi.py.

Definition at line 425 of file xmlifApi.py.

Definition at line 411 of file xmlifApi.py.

Definition at line 276 of file xmlifApi.py.

Definition at line 276 of file xmlifApi.py.

Definition at line 276 of file xmlifApi.py.

Definition at line 276 of file xmlifApi.py.

Definition at line 276 of file xmlifApi.py.

Definition at line 276 of file xmlifApi.py.

Definition at line 276 of file xmlifApi.py.

Definition at line 276 of file xmlifApi.py.

Definition at line 276 of file xmlifApi.py.

Definition at line 276 of file xmlifApi.py.

Definition at line 276 of file xmlifApi.py.


The documentation for this class was generated from the following file:


mavlink
Author(s): Lorenz Meier
autogenerated on Sun May 22 2016 04:05:44