4Suite™ API Documentation

# ► Module Ft.Xml.cDomlette

cDomlette implementation: a very fast DOM-like library tailored for use in XPath/XSLT

    Copyright 2005 Fourthought, Inc. (USA).
    Detailed license and copyright information: http://4suite.org/COPYRIGHT
    Project home, documentation, distributions: http://4suite.org/

Classes: Attr, CharacterData, Comment, DOMImplementation, Document, DocumentFragment, Element, Node, ProcessingInstruction, Text, XPathNamespace |  |  |  | Functions: GetAllNs, NonvalParse, Parse, SeekNss, ValParse |  |  |  | Globals: implementation

## Classes

class Attr(Node)
  The Attr interface represents an attribute in an Element object.

  ### Methods

  __repr__(...)
    x.__repr__() <==> repr(x)

  ### Methods inherited from class Node

  __eq__, __ge__, __gt__, __hash__, __iter__, __le__, __lt__, __ne__, appendChild, cloneNode, hasChildNodes, insertBefore, isSameNode, normalize, removeChild, replaceChild, xpath

  ### Methods inherited from class object

  __delattr__, __getattribute__, __init__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

  ### Members

  localName = <member 'localName' of 'Ft.Xml.cDomlette.Attr' objects>
  name = <member 'name' of 'Ft.Xml.cDomlette.Attr' objects>
  namespaceURI = <member 'namespaceURI' of 'Ft.Xml.cDomlette.Attr' objects>
  nextSibling = None
  nodeName = <member 'nodeName' of 'Ft.Xml.cDomlette.Attr' objects>
  nodeType = 2
  nodeValue = <attribute 'nodeValue' of 'Ft.Xml.cDomlette.Attr' objects>
  ownerElement = <member 'ownerElement' of 'Ft.Xml.cDomlette.Attr' objects>
  prefix = <attribute 'prefix' of 'Ft.Xml.cDomlette.Attr' objects>
  previousSibling = None
  specified = 1
  value = <attribute 'value' of 'Ft.Xml.cDomlette.Attr' objects>

  ### Members inherited from class Node

  attributes, baseURI, childNodes, firstChild, lastChild, ownerDocument, parentNode, rootNode, xmlBase, xpathAttributes, xpathNamespaces

  ### Members inherited from class object

  __class__

  ### Members inherited from class xml.dom.Node

  ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
class CharacterData(Node)
  This interface represents a block of XML character data.

  ### Methods

  __repr__(...)
    x.__repr__() <==> repr(x)
  appendData(...)
    Append the string to the end of the character data of the node.
  deleteData(...)
    Remove a range of unicode units from the node.
  insertData(...)
    Insert a string at the specified unicode unit offset.
  replaceData(...)
    Replace the characters starting at the specified unicode unit offset with the specified string.
  substringData(...)
    Extracts a range of data from the node.

  ### Methods inherited from class Node

  __eq__, __ge__, __gt__, __hash__, __iter__, __le__, __lt__, __ne__, appendChild, cloneNode, hasChildNodes, insertBefore, isSameNode, normalize, removeChild, replaceChild, xpath

  ### Methods inherited from class object

  __delattr__, __getattribute__, __init__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

  ### Members

  data = <attribute 'data' of 'Ft.Xml.cDomlette.CharacterData' objects>
  length = <attribute 'length' of 'Ft.Xml.cDomlette.CharacterData' objects>
  nodeValue = <attribute 'nodeValue' of 'Ft.Xml.cDomlette.CharacterData' objects>

  ### Members inherited from class Node

  attributes, baseURI, childNodes, firstChild, lastChild, localName, namespaceURI, nextSibling, ownerDocument, parentNode, prefix, previousSibling, rootNode, xmlBase, xpathAttributes, xpathNamespaces

  ### Members inherited from class object

  __class__

  ### Members inherited from class xml.dom.Node

  ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
class Comment(CharacterData)
  This interface represents the content of a comment, i.e., all the characters between the starting '<!--' and ending '-->'.

  ### Methods inherited from class CharacterData

  __repr__, appendData, deleteData, insertData, replaceData, substringData

  ### Methods inherited from class Node

  __eq__, __ge__, __gt__, __hash__, __iter__, __le__, __lt__, __ne__, appendChild, cloneNode, hasChildNodes, insertBefore, isSameNode, normalize, removeChild, replaceChild, xpath

  ### Methods inherited from class object

  __delattr__, __getattribute__, __init__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

  ### Members

  nodeName = u'#comment'
  nodeType = 8

  ### Members inherited from class CharacterData

  data, length, nodeValue

  ### Members inherited from class Node

  attributes, baseURI, childNodes, firstChild, lastChild, localName, namespaceURI, nextSibling, ownerDocument, parentNode, prefix, previousSibling, rootNode, xmlBase, xpathAttributes, xpathNamespaces

  ### Members inherited from class object

  __class__

  ### Members inherited from class xml.dom.Node

  ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
class DOMImplementation(object)
  The DOMImplementation interface provides a number of methods for performing operations that are independent of any particular instance of the document object model.

  ### Methods

  __repr__(...)
    x.__repr__() <==> repr(x)
  createDocument(...)
    Creates a Document object of the specified type with its document element.
  createRootNode(...)
    Creates a Document object with the specified documentURI.
  hasFeature(...)
    Test if the DOM implementation implements a specific feature.

  ### Methods inherited from class object

  __delattr__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

  ### Members inherited from class object

  __class__
class Document(Node)
  The Document interface represents the entire XML document. Conceptually, it is the root of the document tree, and provides the primary access to the document's data.

  ### Methods

  __repr__(...)
    x.__repr__() <==> repr(x)
  createAttributeNS(...)
    createAttributeNS(namespaceURI, qualifiedName) -> new Attribute

        Creates an attribute of the given qualified name and namespace URI.

  createComment(...)
    createComment(data) -> new Comment

        Creates a Comment node given the specified string.

  createDocumentFragment(...)
    createDocumentFragment() -> new DocumentFragment

        Creates an empty DocumentFragment object.

  createElementNS(...)
    createElementNS(namespaceURI, qualifiedName) -> new Element

        Creates an element of the given qualified name and namespace URI.

  createProcessingInstruction(...)
    createProcessingInstruction(target, data) -> new ProcessingInstruction

        Creates a ProcessingInstruction node given the specified name and data
        strings.

  createTextNode(...)
    createTextNode(data) -> new Text

        Creates a Text node given the specified string.

  importNode(...)
    importNode(importedNode, deep) -> Node

        Imports a node from another document to this document. The returned node
        has no parent; (parentNode is None). The source node is not altered or
        removed from the original document; this method creates a new copy of the
        source node.

  ### Methods inherited from class Node

  __eq__, __ge__, __gt__, __hash__, __iter__, __le__, __lt__, __ne__, appendChild, cloneNode, hasChildNodes, insertBefore, isSameNode, normalize, removeChild, replaceChild, xpath

  ### Methods inherited from class object

  __delattr__, __getattribute__, __init__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

  ### Members

  baseURI = <member 'baseURI' of 'Ft.Xml.cDomlette.Document' objects>
  doctype = None
  documentElement = <attribute 'documentElement' of 'Ft.Xml.cDomlette.Document' objects>
  documentURI = <member 'documentURI' of 'Ft.Xml.cDomlette.Document' objects>
  implementation = <DOMImplementation>
  nodeName = u'#document'
  nodeType = 9
  ownerDocument = None
  publicId = <attribute 'publicId' of 'Ft.Xml.cDomlette.Document' objects>
  refUri = <member 'refUri' of 'Ft.Xml.cDomlette.Document' objects>
  rootNode = <attribute 'rootNode' of 'Ft.Xml.cDomlette.Document' objects>
  systemId = <attribute 'systemId' of 'Ft.Xml.cDomlette.Document' objects>
  unparsedEntities = <member 'unparsedEntities' of 'Ft.Xml.cDomlette.Document' objects>
  xmlBase = <member 'xmlBase' of 'Ft.Xml.cDomlette.Document' objects>

  ### Members inherited from class Node

  attributes, childNodes, firstChild, lastChild, localName, namespaceURI, nextSibling, nodeValue, parentNode, prefix, previousSibling, xpathAttributes, xpathNamespaces

  ### Members inherited from class object

  __class__

  ### Members inherited from class xml.dom.Node

  ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
class DocumentFragment(Node)
  DocumentFragment is a "lightweight" or "minimal" Document object.

  ### Methods

  __repr__(...)
    x.__repr__() <==> repr(x)

  ### Methods inherited from class Node

  __eq__, __ge__, __gt__, __hash__, __iter__, __le__, __lt__, __ne__, appendChild, cloneNode, hasChildNodes, insertBefore, isSameNode, normalize, removeChild, replaceChild, xpath

  ### Methods inherited from class object

  __delattr__, __getattribute__, __init__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

  ### Members

  nodeName = u'#document-fragment'
  nodeType = 11

  ### Members inherited from class Node

  attributes, baseURI, childNodes, firstChild, lastChild, localName, namespaceURI, nextSibling, nodeValue, ownerDocument, parentNode, prefix, previousSibling, rootNode, xmlBase, xpathAttributes, xpathNamespaces

  ### Members inherited from class object

  __class__

  ### Members inherited from class xml.dom.Node

  ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
class Element(Node)
  The Element interface represents an element in an XML document.

  ### Methods

  __repr__(...)
    x.__repr__() <==> repr(x)
  getAttributeNS(...)
    Retrieves an attribute value by local name and namespace URI.
  getAttributeNodeNS(...)
    Retrieves an Attr node by local name and namespace URI.
  hasAttributeNS(...)
    Returns True when an attribute with a given local name and namespace URI is specified on this element or has a default value, False otherwise.
  removeAttributeNS(...)
    Removes an attribute by local name and namespace URI.
  removeAttributeNode(...)
    Removes the specified attribute node.
  setAttributeNS(...)
    Adds a new attribute. If an attribute with the same local name and namespace URI is already present on the element, its prefix is changed to be the prefix part of the qualifiedName, and its value is changed to be the value parameter.
  setAttributeNodeNS(...)
    Adds a new attribute. If an attribute with that local name and that namespace URI is already present in the element, it is replaced by the new one. Replacing an attribute node by itself has no effect.

  ### Methods inherited from class Node

  __eq__, __ge__, __gt__, __hash__, __iter__, __le__, __lt__, __ne__, appendChild, cloneNode, hasChildNodes, insertBefore, isSameNode, normalize, removeChild, replaceChild, xpath

  ### Methods inherited from class object

  __delattr__, __getattribute__, __init__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

  ### Members

  attributes = <member 'attributes' of 'Ft.Xml.cDomlette.Element' objects>
  localName = <member 'localName' of 'Ft.Xml.cDomlette.Element' objects>
  namespaceURI = <member 'namespaceURI' of 'Ft.Xml.cDomlette.Element' objects>
  nodeName = <member 'nodeName' of 'Ft.Xml.cDomlette.Element' objects>
  nodeType = 1
  prefix = <attribute 'prefix' of 'Ft.Xml.cDomlette.Element' objects>
  tagName = <member 'tagName' of 'Ft.Xml.cDomlette.Element' objects>
  xpathAttributes = <attribute 'xpathAttributes' of 'Ft.Xml.cDomlette.Element' objects>
  xpathNamespaces = <attribute 'xpathNamespaces' of 'Ft.Xml.cDomlette.Element' objects>

  ### Members inherited from class Node

  baseURI, childNodes, firstChild, lastChild, nextSibling, nodeValue, ownerDocument, parentNode, previousSibling, rootNode, xmlBase

  ### Members inherited from class object

  __class__

  ### Members inherited from class xml.dom.Node

  ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
class Node(object, xml.dom.Node)
  The Node type is the primary datatype for the entire Document Object Model.

  ### Methods

  __eq__(...)
    x.__eq__(y) <==> x==y
  __ge__(...)
    x.__ge__(y) <==> x>=y
  __gt__(...)
    x.__gt__(y) <==> x>y
  __hash__(...)
    x.__hash__() <==> hash(x)
  __iter__(...)
    x.__iter__() <==> iter(x)
  __le__(...)
    x.__le__(y) <==> x<=y
  __lt__(...)
    x.__lt__(y) <==> x<y
  __ne__(...)
    x.__ne__(y) <==> x!=y
  __repr__(...)
    x.__repr__() <==> repr(x)
  appendChild(...)
    Adds the node newChild to the end of the list of children of this node.
  cloneNode(...)
    Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.
  hasChildNodes(...)
    Returns whether this node has any children.
  insertBefore(...)
    Inserts the node newChild before the existing child node refChild.
  isSameNode(...)
    Returns whether this node is the same node as the given one. (DOM Level 3)
  normalize(...)
    Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes.
  removeChild(...)
    Removes the child node indicated by oldChild from the list of children, and returns it.
  replaceChild(...)
    Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
  xpath(...)
    Evaluates an XPath expression string using this node as context.

  ### Methods inherited from class object

  __delattr__, __getattribute__, __init__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

  ### Members

  attributes = None
  baseURI = <attribute 'baseURI' of 'Ft.Xml.cDomlette.Node' objects>
  childNodes = <attribute 'childNodes' of 'Ft.Xml.cDomlette.Node' objects>
  firstChild = <attribute 'firstChild' of 'Ft.Xml.cDomlette.Node' objects>
  lastChild = <attribute 'lastChild' of 'Ft.Xml.cDomlette.Node' objects>
  localName = None
  namespaceURI = None
  nextSibling = <attribute 'nextSibling' of 'Ft.Xml.cDomlette.Node' objects>
  nodeValue = None
  ownerDocument = <member 'ownerDocument' of 'Ft.Xml.cDomlette.Node' objects>
  parentNode = <member 'parentNode' of 'Ft.Xml.cDomlette.Node' objects>
  prefix = None
  previousSibling = <attribute 'previousSibling' of 'Ft.Xml.cDomlette.Node' objects>
  rootNode = <member 'rootNode' of 'Ft.Xml.cDomlette.Node' objects>
  xmlBase = <attribute 'xmlBase' of 'Ft.Xml.cDomlette.Node' objects>
  xpathAttributes = <attribute 'xpathAttributes' of 'Ft.Xml.cDomlette.Node' objects>
  xpathNamespaces = <attribute 'xpathNamespaces' of 'Ft.Xml.cDomlette.Node' objects>

  ### Members inherited from class object

  __class__

  ### Members inherited from class xml.dom.Node

  ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
class ProcessingInstruction(Node)
  The ProcessingInstruction interface represents a "processing instruction", used in XML as a way to keep processor-specific information in the text of the document.

  ### Methods

  __repr__(...)
    x.__repr__() <==> repr(x)

  ### Methods inherited from class Node

  __eq__, __ge__, __gt__, __hash__, __iter__, __le__, __lt__, __ne__, appendChild, cloneNode, hasChildNodes, insertBefore, isSameNode, normalize, removeChild, replaceChild, xpath

  ### Methods inherited from class object

  __delattr__, __getattribute__, __init__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

  ### Members

  data = <attribute 'data' of 'Ft.Xml.cDomlette.ProcessingInstruction' objects>
  nodeName = <member 'nodeName' of 'Ft.Xml.cDomlette.ProcessingInstruction' objects>
  nodeType = 7
  nodeValue = <attribute 'nodeValue' of 'Ft.Xml.cDomlette.ProcessingInstruction' objects>
  target = <member 'target' of 'Ft.Xml.cDomlette.ProcessingInstruction' objects>

  ### Members inherited from class Node

  attributes, baseURI, childNodes, firstChild, lastChild, localName, namespaceURI, nextSibling, ownerDocument, parentNode, prefix, previousSibling, rootNode, xmlBase, xpathAttributes, xpathNamespaces

  ### Members inherited from class object

  __class__

  ### Members inherited from class xml.dom.Node

  ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
class Text(CharacterData)
  This interface represents the contents of a text node.

  ### Methods inherited from class CharacterData

  __repr__, appendData, deleteData, insertData, replaceData, substringData

  ### Methods inherited from class Node

  __eq__, __ge__, __gt__, __hash__, __iter__, __le__, __lt__, __ne__, appendChild, cloneNode, hasChildNodes, insertBefore, isSameNode, normalize, removeChild, replaceChild, xpath

  ### Methods inherited from class object

  __delattr__, __getattribute__, __init__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

  ### Members

  nodeName = u'#text'
  nodeType = 3

  ### Members inherited from class CharacterData

  data, length, nodeValue

  ### Members inherited from class Node

  attributes, baseURI, childNodes, firstChild, lastChild, localName, namespaceURI, nextSibling, ownerDocument, parentNode, prefix, previousSibling, rootNode, xmlBase, xpathAttributes, xpathNamespaces

  ### Members inherited from class object

  __class__

  ### Members inherited from class xml.dom.Node

  ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
class XPathNamespace(Node)
  The XPathNamespace interface represents the XPath namespace node type that DOM lacks.

  ### Methods

  __repr__(...)
    x.__repr__() <==> repr(x)

  ### Methods inherited from class Node

  __eq__, __ge__, __gt__, __hash__, __iter__, __le__, __lt__, __ne__, appendChild, cloneNode, hasChildNodes, insertBefore, isSameNode, normalize, removeChild, replaceChild, xpath

  ### Methods inherited from class object

  __delattr__, __getattribute__, __init__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

  ### Members

  localName = <member 'localName' of 'Ft.Xml.cDomlette.XPathNamespace' objects>
  nodeName = <member 'nodeName' of 'Ft.Xml.cDomlette.XPathNamespace' objects>
  nodeType = 13
  nodeValue = <member 'nodeValue' of 'Ft.Xml.cDomlette.XPathNamespace' objects>
  value = <member 'value' of 'Ft.Xml.cDomlette.XPathNamespace' objects>

  ### Members inherited from class Node

  attributes, baseURI, childNodes, firstChild, lastChild, namespaceURI, nextSibling, ownerDocument, parentNode, prefix, previousSibling, rootNode, xmlBase, xpathAttributes, xpathNamespaces

  ### Members inherited from class object

  __class__

  ### Members inherited from class xml.dom.Node

  ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE

## Functions

GetAllNs(node)
  GetAllNs(node) -> dict

      Get all of the namespaces defined in scope of this node.

NonvalParse(isrc[, readExtDtd])
  NonvalParse(isrc[, readExtDtd]) -> Document
Parse(isrc[, readExtDtd])
  Parse(isrc[, readExtDtd]) -> Document
SeekNss(node)
  SeekNss(node) -> dict

      Traverses the tree to seek an approximate set of defined namespaces.

ValParse(isrc)
  ValParse(isrc) -> Document

## Globals

implementation = <DOMImplementation>
  The DOMImplementation interface provides a number of methods for performing operations that are independent of any particular instance of the document object model.