2005-11-15 04:36:08

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/

The Attr interface represents an attribute in an Element object.

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

...
- <member 'localName' of 'Ft.Xml.cDomlette.Attr' objects>
- <member 'name' of 'Ft.Xml.cDomlette.Attr' objects>
- <member 'namespaceURI' of 'Ft.Xml.cDomlette.Attr' objects>
- None
- <member 'nodeName' of 'Ft.Xml.cDomlette.Attr' objects>
- 2
- <attribute 'nodeValue' of 'Ft.Xml.cDomlette.Attr' objects>
- <member 'ownerElement' of 'Ft.Xml.cDomlette.Attr' objects>
- <attribute 'prefix' of 'Ft.Xml.cDomlette.Attr' objects>
- None
- 1
- <attribute 'value' of 'Ft.Xml.cDomlette.Attr' objects>

This interface represents a block of XML character data.

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

...

Append the string to the end of the character data of the node.

...

Remove a range of unicode units from the node.

...

Insert a string at the specified unicode unit offset.

...

Replace the characters starting at the specified unicode unit offset with the specified string.

...

Extracts a range of data from the node.

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

This interface represents the content of a comment, i.e., all the characters between the starting '<!--' and ending '-->'.

- u'#comment'
- 8

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

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

...

Creates a Document object of the specified type with its document element.

...

Creates a Document object with the specified documentURI.

...

Test if the DOM implementation implements a specific feature.

...

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.

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

...

createAttributeNS(namespaceURI, qualifiedName) -> new Attribute

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

createComment(data) -> new Comment

Creates a Comment node given the specified string.
...

createDocumentFragment() -> new DocumentFragment

Creates an empty DocumentFragment object.
...

createElementNS(namespaceURI, qualifiedName) -> new Element

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

createProcessingInstruction(target, data) -> new ProcessingInstruction

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

createTextNode(data) -> new Text

Creates a Text node given the specified string.
...

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.
...
- <member 'baseURI' of 'Ft.Xml.cDomlette.Document' objects>
- None
- <attribute 'documentElement' of 'Ft.Xml.cDomlette.Document' objects>
- <member 'documentURI' of 'Ft.Xml.cDomlette.Document' objects>
- <DOMImplementation>
- u'#document'
- 9
- None
- <attribute 'publicId' of 'Ft.Xml.cDomlette.Document' objects>
- <member 'refUri' of 'Ft.Xml.cDomlette.Document' objects>
- <attribute 'rootNode' of 'Ft.Xml.cDomlette.Document' objects>
- <attribute 'systemId' of 'Ft.Xml.cDomlette.Document' objects>
- <member 'unparsedEntities' of 'Ft.Xml.cDomlette.Document' objects>
- <member 'xmlBase' of 'Ft.Xml.cDomlette.Document' objects>

DocumentFragment is a "lightweight" or "minimal" Document object.

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

...
- u'#document-fragment'
- 11

The Element interface represents an element in an XML document.

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

...

Retrieves an attribute value by local name and namespace URI.

...

Retrieves an Attr node by local name and namespace URI.

...

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.

...

Removes an attribute by local name and namespace URI.

...

Removes the specified attribute node.

...

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.

...

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.

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

The Node type is the primary datatype for the entire Document Object Model.

x.__eq__(y) <==> x==y

...

x.__ge__(y) <==> x>=y

...

x.__gt__(y) <==> x>y

...

x.__hash__() <==> hash(x)

...

x.__iter__() <==> iter(x)

...

x.__le__(y) <==> x<=y

...

x.__lt__(y) <==> x<y

...

x.__ne__(y) <==> x!=y

...

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

...

Adds the node newChild to the end of the list of children of this node.

...

Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.

...

Returns whether this node has any children.

...

Inserts the node newChild before the existing child node refChild.

...

Returns whether this node is the same node as the given one. (DOM Level 3)

...

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.

...

Removes the child node indicated by oldChild from the list of children, and returns it.

...

Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.

...

Evaluates an XPath expression string using this node as context.

...
- None
- <attribute 'baseURI' of 'Ft.Xml.cDomlette.Node' objects>
- <attribute 'childNodes' of 'Ft.Xml.cDomlette.Node' objects>
- <attribute 'firstChild' of 'Ft.Xml.cDomlette.Node' objects>
- <attribute 'lastChild' of 'Ft.Xml.cDomlette.Node' objects>
- None
- None
- <attribute 'nextSibling' of 'Ft.Xml.cDomlette.Node' objects>
- None
- <member 'ownerDocument' of 'Ft.Xml.cDomlette.Node' objects>
- <member 'parentNode' of 'Ft.Xml.cDomlette.Node' objects>
- None
- <attribute 'previousSibling' of 'Ft.Xml.cDomlette.Node' objects>
- <member 'rootNode' of 'Ft.Xml.cDomlette.Node' objects>
- <attribute 'xmlBase' of 'Ft.Xml.cDomlette.Node' objects>
- <attribute 'xpathAttributes' of 'Ft.Xml.cDomlette.Node' objects>
- <attribute 'xpathNamespaces' of 'Ft.Xml.cDomlette.Node' objects>

The ProcessingInstruction interface represents a "processing instruction", used in XML as a way to keep processor-specific information in the text of the document.

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

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

This interface represents the contents of a text node.

- u'#text'
- 3

The XPathNamespace interface represents the XPath namespace node type that DOM lacks.

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

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

GetAllNs(node) -> dict

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

NonvalParse(isrc[, readExtDtd]) -> Document

isrc[, readExtDtd]

Parse(isrc[, readExtDtd]) -> Document

isrc[, readExtDtd]

Take an XPointer fragment and return a structure suitable for the cDomlette parser to update state tables Xptr e.g. xmlns(x=http://uche.ogbuji.net/eg) xpointer(/x:spam/x:eggs)

SeekNss(node) -> dict

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

ValParse(isrc) -> Document

isrc
3
1
0
2
u'http://www.w3.org/2000/xmlns/'
u'http://www.w3.org/XML/1998/namespace'
['implementation', 'DOMImplementation', 'DocumentFragment', 'Document', 'Node', 'CharacterData', 'Attr', 'Element', 'Text', 'Comment', 'ProcessingInstruction', 'XPathNamespace', 'NonvalParse', 'Parse', 'GetAllNs', 'SeekNss', 'ValParse']

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

<DOMImplementation>