Module libxml2 :: Class xmlNode
[frames | no frames]

Class xmlNode

xmlCore --+
          |
         xmlNode

Known Subclasses:
TmplCipherReference, TmplEncData, TmplKeyInfo, TmplManifest, TmplObject, TmplReference, TmplRetrievalMethod, TmplSignature, TmplTransform

Method Summary
  __init__(self, _obj)
  __repr__(self)
  addChild(self, cur)
Add a new node to @parent, at the end of the child (or property) list merging adjacent TEXT nodes (in which case @cur is freed) If the new node is ATTRIBUTE, it is added into properties instead of children.
  addChildList(self, cur)
Add a list of node at the end of the child list of the...
  addContent(self, content)
Append the extra substring to the node content.
  addContentLen(self, content, len)
Append the extra substring to the node content.
  addNextSibling(self, elem)
Add a new node @elem as the next sibling of @cur If the new node was already inserted in a document it is first unlinked from its existing context.
  addPrevSibling(self, elem)
Add a new node @elem as the previous sibling of @cur merging adjacent TEXT nodes (@elem may be freed) If the new node was already inserted in a document it is first unlinked from its existing context.
  addSibling(self, elem)
Add a new element @elem to the list of siblings of @cur merging adjacent TEXT nodes (@elem may be freed) If the new element was already inserted in a document it is first unlinked from its existing context.
  copyNode(self, extended)
Do a copy of the node.
  copyNodeList(self)
Do a recursive copy of the node list.
  copyProp(self, cur)
Do a copy of the attribute.
  copyPropList(self, cur)
Do a copy of an attribute list.
  debugDumpNode(self, output, depth)
Dumps debug information for the element node, it is...
  debugDumpNodeList(self, output, depth)
Dumps debug information for the list of element node, it is...
  debugDumpOneNode(self, output, depth)
Dumps debug information for the element node, it is not...
  docCopyNode(self, doc, extended)
Do a copy of the node to a given document.
  docSetRootElement(self, doc)
Set the root element of the document (doc->children is a list containing possibly comments, PIs, etc ...).
  freeNode(self)
Free a node, this is a recursive behaviour, all the children are freed too.
  freeNodeList(self)
Free a node and all its siblings, this is a recursive behaviour, all the children are freed too.
  getBase(self, doc)
Searches for the BASE URL.
  getContent(self)
Read the value of a node, this can be either the text carried directly by this node if it's a TEXT node or the aggregate string of the values carried by this node child's (TEXT and ENTITY_REF).
  getLang(self)
Searches the language of a node, i.e.
  getSpacePreserve(self)
Searches the space preserving behaviour of a node, i.e.
  hasNsProp(self, name, nameSpace)
Search for an attribute associated to a node This attribute has to be anchored in the namespace specified.
  hasProp(self, name)
Search an attribute associated to a node This function also looks in DTD attribute declaration for #FIXED or default declaration values unless DTD use has been turned off.
  isBlankNode(self)
Checks whether this node is an empty or whitespace only (and possibly ignorable) text-node.
  isID(self, doc, attr)
Determine whether an attribute is of type ID.
  isRef(self, doc, attr)
Determine whether an attribute is of type Ref.
  isText(self)
Is this node a Text node ?...
  lastChild(self)
Search the last child of a node.
  lineNo(self)
Get line number of @node.
  listGetRawString(self, doc, inLine)
Builds the string equivalent to the text contained in the Node list made of TEXTs and ENTITY_REFs, contrary to xmlNodeListGetString() this function doesn't do any character encoding handling.
  listGetString(self, doc, inLine)
Build the string equivalent to the text contained in the...
  lsCountNode(self)
Count the children of @node.
  lsOneNode(self, output)
Dump to @output the type and name of @node.
  newChild(self, ns, name, content)
Creation of a new child element, added at the end of @parent children list.
  newNs(self, href, prefix)
Creation of a new Namespace.
  newNsProp(self, ns, name, value)
Create a new property tagged with a namespace and carried by a node.
  newNsPropEatName(self, ns, name, value)
Create a new property tagged with a namespace and carried by a node.
  newProp(self, name, value)
Create a new property carried by a node.
  newTextChild(self, ns, name, content)
Creation of a new child element, added at the end of @parent children list.
  nodePath(self)
Build a structure based Path for the given node...
  noNsProp(self, name)
Search and get the value of an attribute associated to a node This does the entity substitution.
  ns(self)
Get the namespace of a node...
  nsDefs(self)
Get the namespace of a node...
  nsProp(self, name, nameSpace)
Search and get the value of an attribute associated to a node This attribute has to be anchored in the namespace specified.
  prop(self, name)
Search and get the value of an attribute associated to a node This does the entity substitution.
  reconciliateNs(self, doc)
This function checks that all the namespaces declared within the given tree are properly declared.
  replaceNode(self, cur)
Unlink the old node from its current context, prune the new one at the same place.
  searchNs(self, doc, nameSpace)
Search a Ns registered under a given name space for a document.
  searchNsByHref(self, doc, href)
Search a Ns aliasing a given URI.
  setBase(self, uri)
Set (or reset) the base URI of a node, i.e.
  setContent(self, content)
Replace the content of a node.
  setContentLen(self, content, len)
Replace the content of a node.
  setLang(self, lang)
Set the language of a node, i.e.
  setListDoc(self, doc)
update all nodes in the list to point to the right document...
  setName(self, name)
Set (or reset) the name of a node.
  setNs(self, ns)
Associate a namespace to a node, a posteriori.
  setNsProp(self, ns, name, value)
Set (or reset) an attribute carried by a node.
  setProp(self, name, value)
Set (or reset) an attribute carried by a node.
  setSpacePreserve(self, val)
Set (or reset) the space preserving behaviour of a node, i.e.
  setTreeDoc(self, doc)
update all nodes under the tree to point to the right...
  shellPrintNode(self)
Print node to the output FILE...
  textConcat(self, content, len)
Concat the given string at the end of the existing node...
  textMerge(self, second)
Merge two text nodes into one...
  unlinkNode(self)
Unlink a node from it's current context, the node is not...
  unsetNsProp(self, ns, name)
Remove an attribute carried by a node.
  unsetProp(self, name)
Remove an attribute carried by a node.
  validNormalizeAttributeValue(self, doc, name, value)
Does the validation related extra step of the normalization of attribute values: If the declared value is not CDATA, then the XML processor must further process the normalized attribute value by discarding any leading and trailing space (#x20) characters, and by replacing sequences of space (#x20) characters by single space (#x20) character.
  xincludeProcessTree(self)
Implement the XInclude substitution for the given subtree...
  xincludeProcessTreeFlags(self, flags)
Implement the XInclude substitution for the given subtree...
  xpathCastNodeToNumber(self)
Converts a node to its number value...
  xpathCastNodeToString(self)
Converts a node to its string value.
  xpathCmpNodes(self, node2)
Compare two nodes w.r.t document order...
  xpathNewNodeSet(self)
Create a new xmlXPathObjectPtr of type NodeSet and...
  xpathNewValueTree(self)
Create a new xmlXPathObjectPtr of type Value Tree (XSLT)...
  xpathNextAncestor(self, ctxt)
Traversal function for the "ancestor" direction the...
  xpathNextAncestorOrSelf(self, ctxt)
Traversal function for the "ancestor-or-self" direction he ancestor-or-self axis contains the context node and ancestors of the context node in reverse document order; thus the context node is the first node on the axis, and the context node's parent the second; parent here is defined the same as with the parent axis.
  xpathNextAttribute(self, ctxt)
Traversal function for the "attribute" direction TODO:...
  xpathNextChild(self, ctxt)
Traversal function for the "child" direction The child axis contains the children of the context node in document order.
  xpathNextDescendant(self, ctxt)
Traversal function for the "descendant" direction the descendant axis contains the descendants of the context node in document order; a descendant is a child or a child of a child and so on.
  xpathNextDescendantOrSelf(self, ctxt)
Traversal function for the "descendant-or-self" direction...
  xpathNextFollowing(self, ctxt)
Traversal function for the "following" direction The...
  xpathNextFollowingSibling(self, ctxt)
Traversal function for the "following-sibling" direction The following-sibling axis contains the following siblings of the context node in document order.
  xpathNextNamespace(self, ctxt)
Traversal function for the "namespace" direction the namespace axis contains the namespace nodes of the context node; the order of nodes on this axis is implementation-defined; the axis will be empty unless the context node is an element We keep the XML namespace node at the end of the list.
  xpathNextParent(self, ctxt)
Traversal function for the "parent" direction The parent axis contains the parent of the context node, if there is one.
  xpathNextPreceding(self, ctxt)
Traversal function for the "preceding" direction the...
  xpathNextPrecedingSibling(self, ctxt)
Traversal function for the "preceding-sibling" direction The preceding-sibling axis contains the preceding siblings of the context node in reverse document order; the first preceding sibling is first on the axis; the sibling preceding that node is the second on the axis and so on.
  xpathNextSelf(self, ctxt)
Traversal function for the "self" direction The self axis...
  xpointerNewCollapsedRange(self)
Create a new xmlXPathObjectPtr of type range using a single...
  xpointerNewContext(self, doc, origin)
Create a new XPointer context...
  xpointerNewLocationSetNodes(self, end)
Create a new xmlXPathObjectPtr of type LocationSet and...
  xpointerNewRange(self, startindex, end, endindex)
Create a new xmlXPathObjectPtr of type range...
  xpointerNewRangeNodes(self, end)
Create a new xmlXPathObjectPtr of type range using 2 nodes...
    Inherited from xmlCore
  __iter__(self)
  c14nMemory(self, nodes, exclusive, prefixes, with_comments)
  c14nSaveTo(self, file, nodes, exclusive, prefixes, with_comments)
  free(self)
  get_children(self)
  get_content(self)
  get_doc(self)
  get_last(self)
  get_name(self)
  get_next(self)
  get_parent(self)
  get_prev(self)
  get_properties(self)
  get_type(self)
  saveTo(self, file, encoding, format)
  serialize(self, encoding, format)
  walk_breadth_first(self)
  walk_depth_first(self)
  xpathEval(self, expr)
  xpathEval2(self, expr)

Property Summary
    Inherited from xmlCore
  children: First child node...
  content: Content of this node...
  doc: The document this node belongs to...
  last: Last sibling node...
  name: Node name...
  next: Next sibling node...
  parent: Parent node...
  prev: Previous sibling node...
  properties: List of properies...
  type: Node type...

Method Details

addChild(self, cur)

Add a new node to @parent, at the end of the child (or
property) list merging adjacent TEXT nodes (in which case
@cur is freed) If the new node is ATTRIBUTE, it is added
into properties instead of children. If there is an
attribute with equal name, it is first destroyed.

addChildList(self, cur)

Add a list of node at the end of the child list of the
parent merging adjacent TEXT nodes (@cur may be freed)

addContent(self, content)

Append the extra substring to the node content.

addContentLen(self, content, len)

Append the extra substring to the node content.

addNextSibling(self, elem)

Add a new node @elem as the next sibling of @cur If the new
node was already inserted in a document it is first
unlinked from its existing context. As a result of text
merging @elem may be freed. If the new node is ATTRIBUTE,
it is added into properties instead of children. If there
is an attribute with equal name, it is first destroyed.

addPrevSibling(self, elem)

Add a new node @elem as the previous sibling of @cur
merging adjacent TEXT nodes (@elem may be freed) If the
new node was already inserted in a document it is first
unlinked from its existing context. If the new node is
ATTRIBUTE, it is added into properties instead of
children. If there is an attribute with equal name, it is
first destroyed.

addSibling(self, elem)

Add a new element @elem to the list of siblings of @cur
merging adjacent TEXT nodes (@elem may be freed) If the
new element was already inserted in a document it is first
unlinked from its existing context.

copyNode(self, extended)

Do a copy of the node.

copyNodeList(self)

Do a recursive copy of the node list.

copyProp(self, cur)

Do a copy of the attribute.

copyPropList(self, cur)

Do a copy of an attribute list.

debugDumpNode(self, output, depth)

Dumps debug information for the element node, it is
recursive

debugDumpNodeList(self, output, depth)

Dumps debug information for the list of element node, it is
recursive

debugDumpOneNode(self, output, depth)

Dumps debug information for the element node, it is not
recursive

docCopyNode(self, doc, extended)

Do a copy of the node to a given document.

docSetRootElement(self, doc)

Set the root element of the document (doc->children is a
list containing possibly comments, PIs, etc ...).

freeNode(self)

Free a node, this is a recursive behaviour, all the
children are freed too. This doesn't unlink the child from
the list, use xmlUnlinkNode() first.

freeNodeList(self)

Free a node and all its siblings, this is a recursive
behaviour, all the children are freed too.

getBase(self, doc)

Searches for the BASE URL. The code should work on both XML
and HTML document even if base mechanisms are completely
different. It returns the base as defined in RFC 2396
sections 5.1.1. Base URI within Document Content and
5.1.2. Base URI from the Encapsulating Entity However it
does not return the document base (5.1.3), use
xmlDocumentGetBase() for this

getContent(self)

Read the value of a node, this can be either the text
carried directly by this node if it's a TEXT node or the
aggregate string of the values carried by this node
child's (TEXT and ENTITY_REF). Entity references are
substituted.
Overrides:
libxml2.xmlCore.get_content

getLang(self)

Searches the language of a node, i.e. the values of the
xml:lang attribute or the one carried by the nearest
ancestor.

getSpacePreserve(self)

Searches the space preserving behaviour of a node, i.e. the
values of the xml:space attribute or the one carried by
the nearest ancestor.

hasNsProp(self, name, nameSpace)

Search for an attribute associated to a node This attribute
has to be anchored in the namespace specified. This does
the entity substitution. This function looks in DTD
attribute declaration for #FIXED or default declaration
values unless DTD use has been turned off.

hasProp(self, name)

Search an attribute associated to a node This function also
looks in DTD attribute declaration for #FIXED or default
declaration values unless DTD use has been turned off.

isBlankNode(self)

Checks whether this node is an empty or whitespace only
(and possibly ignorable) text-node.

isID(self, doc, attr)

Determine whether an attribute is of type ID. In case we
have DTD(s) then this is done if DTD loading has been
requested. In the case of HTML documents parsed with the
HTML parser, then ID detection is done systematically.

isRef(self, doc, attr)

Determine whether an attribute is of type Ref. In case we
have DTD(s) then this is simple, otherwise we use an
heuristic: name Ref (upper or lowercase).

isText(self)

Is this node a Text node ?

lastChild(self)

Search the last child of a node.

lineNo(self)

Get line number of @node. This requires activation of this
option before invoking the parser by calling
xmlLineNumbersDefault(1)

listGetRawString(self, doc, inLine)

Builds the string equivalent to the text contained in the
Node list made of TEXTs and ENTITY_REFs, contrary to
xmlNodeListGetString() this function doesn't do any
character encoding handling.

listGetString(self, doc, inLine)

Build the string equivalent to the text contained in the
Node list made of TEXTs and ENTITY_REFs

lsCountNode(self)

Count the children of @node.

lsOneNode(self, output)

Dump to @output the type and name of @node.

newChild(self, ns, name, content)

Creation of a new child element, added at the end of
@parent children list. @ns and @content parameters are
optional (None). If @ns is None, the newly created element
inherits the namespace of @parent. If @content is non
None, a child list containing the TEXTs and ENTITY_REFs
node will be created. NOTE: @content is supposed to be a
piece of XML CDATA, so it allows entity references. XML
special chars must be escaped first by using
xmlEncodeEntitiesReentrant(), or xmlNewTextChild() should
be used.

newNs(self, href, prefix)

Creation of a new Namespace. This function will refuse to
create a namespace with a similar prefix than an existing
one present on this node. We use href==None in the case of
an element creation where the namespace was not defined.

newNsProp(self, ns, name, value)

Create a new property tagged with a namespace and carried
by a node.

newNsPropEatName(self, ns, name, value)

Create a new property tagged with a namespace and carried
by a node.

newProp(self, name, value)

Create a new property carried by a node.

newTextChild(self, ns, name, content)

Creation of a new child element, added at the end of
@parent children list. @ns and @content parameters are
optional (None). If @ns is None, the newly created element
inherits the namespace of @parent. If @content is non
None, a child TEXT node will be created containing the
string @content. NOTE: Use xmlNewChild() if @content will
contain entities that need to be preserved. Use this
function, xmlNewTextChild(), if you need to ensure that
reserved XML chars that might appear in @content, such as
the ampersand, greater-than or less-than signs, are
automatically replaced by their XML escaped entity
representations.

nodePath(self)

Build a structure based Path for the given node

noNsProp(self, name)

Search and get the value of an attribute associated to a
node This does the entity substitution. This function
looks in DTD attribute declaration for #FIXED or default
declaration values unless DTD use has been turned off.
This function is similar to xmlGetProp except it will
accept only an attribute in no namespace.

ns(self)

Get the namespace of a node

nsDefs(self)

Get the namespace of a node

nsProp(self, name, nameSpace)

Search and get the value of an attribute associated to a
node This attribute has to be anchored in the namespace
specified. This does the entity substitution. This
function looks in DTD attribute declaration for #FIXED or
default declaration values unless DTD use has been turned
off.

prop(self, name)

Search and get the value of an attribute associated to a
node This does the entity substitution. This function
looks in DTD attribute declaration for #FIXED or default
declaration values unless DTD use has been turned off.
NOTE: this function acts independently of namespaces
associated to the attribute. Use xmlGetNsProp() or
xmlGetNoNsProp() for namespace aware processing.

reconciliateNs(self, doc)

This function checks that all the namespaces declared
within the given tree are properly declared. This is
needed for example after Copy or Cut and then paste
operations. The subtree may still hold pointers to
namespace declarations outside the subtree or
invalid/masked. As much as possible the function try to
reuse the existing namespaces found in the new
environment. If not possible the new namespaces are
redeclared on @tree at the top of the given subtree.

replaceNode(self, cur)

Unlink the old node from its current context, prune the new
one at the same place. If @cur was already inserted in a
document it is first unlinked from its existing context.

searchNs(self, doc, nameSpace)

Search a Ns registered under a given name space for a
document. recurse on the parents until it finds the
defined namespace or return None otherwise. @nameSpace can
be None, this is a search for the default namespace. We
don't allow to cross entities boundaries. If you don't
declare the namespace within those you will be in troubles
!!! A warning is generated to cover this case.

searchNsByHref(self, doc, href)

Search a Ns aliasing a given URI. Recurse on the parents
until it finds the defined namespace or return None
otherwise.

setBase(self, uri)

Set (or reset) the base URI of a node, i.e. the value of
the xml:base attribute.

setContent(self, content)

Replace the content of a node.

setContentLen(self, content, len)

Replace the content of a node.

setLang(self, lang)

Set the language of a node, i.e. the values of the xml:lang
attribute.

setListDoc(self, doc)

update all nodes in the list to point to the right document

setName(self, name)

Set (or reset) the name of a node.

setNs(self, ns)

Associate a namespace to a node, a posteriori.

setNsProp(self, ns, name, value)

Set (or reset) an attribute carried by a node. The ns
structure must be in scope, this is not checked.

setProp(self, name, value)

Set (or reset) an attribute carried by a node.

setSpacePreserve(self, val)

Set (or reset) the space preserving behaviour of a node,
i.e. the value of the xml:space attribute.

setTreeDoc(self, doc)

update all nodes under the tree to point to the right
document

shellPrintNode(self)

Print node to the output FILE

textConcat(self, content, len)

Concat the given string at the end of the existing node
content

textMerge(self, second)

Merge two text nodes into one

unlinkNode(self)

Unlink a node from it's current context, the node is not
freed

unsetNsProp(self, ns, name)

Remove an attribute carried by a node.

unsetProp(self, name)

Remove an attribute carried by a node.

validNormalizeAttributeValue(self, doc, name, value)

Does the validation related extra step of the normalization
of attribute values:  If the declared value is not CDATA,
then the XML processor must further process the normalized
attribute value by discarding any leading and trailing
space (#x20) characters, and by replacing sequences of
space (#x20) characters by single space (#x20) character.

xincludeProcessTree(self)

Implement the XInclude substitution for the given subtree

xincludeProcessTreeFlags(self, flags)

Implement the XInclude substitution for the given subtree

xpathCastNodeToNumber(self)

Converts a node to its number value

xpathCastNodeToString(self)

Converts a node to its string value.

xpathCmpNodes(self, node2)

Compare two nodes w.r.t document order

xpathNewNodeSet(self)

Create a new xmlXPathObjectPtr of type NodeSet and
initialize it with the single Node @val

xpathNewValueTree(self)

Create a new xmlXPathObjectPtr of type Value Tree (XSLT)
and initialize it with the tree root @val

xpathNextAncestor(self, ctxt)

Traversal function for the "ancestor" direction the
ancestor axis contains the ancestors of the context node;
the ancestors of the context node consist of the parent of
context node and the parent's parent and so on; the nodes
are ordered in reverse document order; thus the parent is
the first node on the axis, and the parent's parent is the
second node on the axis

xpathNextAncestorOrSelf(self, ctxt)

Traversal function for the "ancestor-or-self" direction he
ancestor-or-self axis contains the context node and
ancestors of the context node in reverse document order;
thus the context node is the first node on the axis, and
the context node's parent the second; parent here is
defined the same as with the parent axis.

xpathNextAttribute(self, ctxt)

Traversal function for the "attribute" direction TODO:
support DTD inherited default attributes

xpathNextChild(self, ctxt)

Traversal function for the "child" direction The child axis
contains the children of the context node in document
order.

xpathNextDescendant(self, ctxt)

Traversal function for the "descendant" direction the
descendant axis contains the descendants of the context
node in document order; a descendant is a child or a child
of a child and so on.

xpathNextDescendantOrSelf(self, ctxt)

Traversal function for the "descendant-or-self" direction
the descendant-or-self axis contains the context node and
the descendants of the context node in document order;
thus the context node is the first node on the axis, and
the first child of the context node is the second node on
the axis

xpathNextFollowing(self, ctxt)

Traversal function for the "following" direction The
following axis contains all nodes in the same document as
the context node that are after the context node in
document order, excluding any descendants and excluding
attribute nodes and namespace nodes; the nodes are ordered
in document order

xpathNextFollowingSibling(self, ctxt)

Traversal function for the "following-sibling" direction
The following-sibling axis contains the following siblings
of the context node in document order.

xpathNextNamespace(self, ctxt)

Traversal function for the "namespace" direction the
namespace axis contains the namespace nodes of the context
node; the order of nodes on this axis is
implementation-defined; the axis will be empty unless the
context node is an element  We keep the XML namespace node
at the end of the list.

xpathNextParent(self, ctxt)

Traversal function for the "parent" direction The parent
axis contains the parent of the context node, if there is
one.

xpathNextPreceding(self, ctxt)

Traversal function for the "preceding" direction the
preceding axis contains all nodes in the same document as
the context node that are before the context node in
document order, excluding any ancestors and excluding
attribute nodes and namespace nodes; the nodes are ordered
in reverse document order

xpathNextPrecedingSibling(self, ctxt)

Traversal function for the "preceding-sibling" direction
The preceding-sibling axis contains the preceding siblings
of the context node in reverse document order; the first
preceding sibling is first on the axis; the sibling
preceding that node is the second on the axis and so on.

xpathNextSelf(self, ctxt)

Traversal function for the "self" direction The self axis
contains just the context node itself

xpointerNewCollapsedRange(self)

Create a new xmlXPathObjectPtr of type range using a single
nodes

xpointerNewContext(self, doc, origin)

Create a new XPointer context

xpointerNewLocationSetNodes(self, end)

Create a new xmlXPathObjectPtr of type LocationSet and
initialize it with the single range made of the two nodes
@start and @end

xpointerNewRange(self, startindex, end, endindex)

Create a new xmlXPathObjectPtr of type range

xpointerNewRangeNodes(self, end)

Create a new xmlXPathObjectPtr of type range using 2 nodes

Generated by Epydoc 2.1 on Sun Jan 1 18:42:41 2006 http://epydoc.sf.net