INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
Creation of a new node containing a comment.
def newComment(content): """Creation of a new node containing a comment. """ ret = libxml2mod.xmlNewComment(content) if ret is None:raise treeError('xmlNewComment() failed') return xmlNode(_obj=ret)
Creates a new XML document
def newDoc(version): """Creates a new XML document """ ret = libxml2mod.xmlNewDoc(version) if ret is None:raise treeError('xmlNewDoc() failed') return xmlDoc(_obj=ret)
Creation of a processing instruction element. Use xmlDocNewPI preferably to get string interning
def newPI(name, content): """Creation of a processing instruction element. Use xmlDocNewPI preferably to get string interning """ ret = libxml2mod.xmlNewPI(name, content) if ret is None:raise treeError('xmlNewPI() failed') return xmlNode(_obj=ret)
Creation of a new text node.
def newText(content): """Creation of a new text node. """ ret = libxml2mod.xmlNewText(content) if ret is None:raise treeError('xmlNewText() failed') return xmlNode(_obj=ret)
Creation of a new text node with an extra parameter for the content s length
def newTextLen(content, len): """Creation of a new text node with an extra parameter for the content's length """ ret = libxml2mod.xmlNewTextLen(content, len) if ret is None:raise treeError('xmlNewTextLen() failed') return xmlNode(_obj=ret)
Unescaping routine but does not check that the string is an URI. The output is a direct unsigned char translation of %XX values ( no encoding ) Note that the length of the result can only be smaller or same size as the input string.
def URIUnescapeString(str, len, target): """Unescaping routine, but does not check that the string is an URI. The output is a direct unsigned char translation of %XX values (no encoding) Note that the length of the result can only be smaller or same size as the input string. """ ret = libxml2...
Parse an URI based on RFC 3986 URI - reference = [ absoluteURI | relativeURI ] [ # fragment ]
def parseURI(str): """Parse an URI based on RFC 3986 URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] """ ret = libxml2mod.xmlParseURI(str) if ret is None:raise uriError('xmlParseURI() failed') return URI(_obj=ret)
Parse an URI but allows to keep intact the original fragments. URI - reference = URI/ relative - ref
def parseURIRaw(str, raw): """Parse an URI but allows to keep intact the original fragments. URI-reference = URI / relative-ref """ ret = libxml2mod.xmlParseURIRaw(str, raw) if ret is None:raise uriError('xmlParseURIRaw() failed') return URI(_obj=ret)
Create an xmlTextReader structure fed with the resource at
def newTextReaderFilename(URI): """Create an xmlTextReader structure fed with the resource at @URI """ ret = libxml2mod.xmlNewTextReaderFilename(URI) if ret is None:raise treeError('xmlNewTextReaderFilename() failed') return xmlTextReader(_obj=ret)
Create an xmltextReader for an XML in - memory document. The parsing flags
def readerForDoc(cur, URL, encoding, options): """Create an xmltextReader for an XML in-memory document. The parsing flags @options are a combination of xmlParserOption. """ ret = libxml2mod.xmlReaderForDoc(cur, URL, encoding, options) if ret is None:raise treeError('xmlReaderForDoc() failed') ret...
Create an xmltextReader for an XML from a file descriptor. The parsing flags
def readerForFd(fd, URL, encoding, options): """Create an xmltextReader for an XML from a file descriptor. The parsing flags @options are a combination of xmlParserOption. NOTE that the file descriptor will not be closed when the reader is closed or reset. """ ret = libxml2mod.xmlReaderForFd(...
parse an XML file from the filesystem or the network. The parsing flags
def readerForFile(filename, encoding, options): """parse an XML file from the filesystem or the network. The parsing flags @options are a combination of xmlParserOption. """ ret = libxml2mod.xmlReaderForFile(filename, encoding, options) if ret is None:raise treeError('xmlReaderForFile() failed') r...
Create an xmltextReader for an XML in - memory document. The parsing flags
def readerForMemory(buffer, size, URL, encoding, options): """Create an xmltextReader for an XML in-memory document. The parsing flags @options are a combination of xmlParserOption. """ ret = libxml2mod.xmlReaderForMemory(buffer, size, URL, encoding, options) if ret is None:raise treeError('xmlReaderF...
Parses a regular expression conforming to XML Schemas Part 2 Datatype Appendix F and builds an automata suitable for testing strings against that regular expression
def regexpCompile(regexp): """Parses a regular expression conforming to XML Schemas Part 2 Datatype Appendix F and builds an automata suitable for testing strings against that regular expression """ ret = libxml2mod.xmlRegexpCompile(regexp) if ret is None:raise treeError('xmlRegexpCompile() fai...
Create an XML Schemas parse context for that memory buffer expected to contain an XML Schemas file.
def schemaNewMemParserCtxt(buffer, size): """Create an XML Schemas parse context for that memory buffer expected to contain an XML Schemas file. """ ret = libxml2mod.xmlSchemaNewMemParserCtxt(buffer, size) if ret is None:raise parserError('xmlSchemaNewMemParserCtxt() failed') return SchemaParserC...
Create an XML Schemas parse context for that file/ resource expected to contain an XML Schemas file.
def schemaNewParserCtxt(URL): """Create an XML Schemas parse context for that file/resource expected to contain an XML Schemas file. """ ret = libxml2mod.xmlSchemaNewParserCtxt(URL) if ret is None:raise parserError('xmlSchemaNewParserCtxt() failed') return SchemaParserCtxt(_obj=ret)
Create a substring from a given UTF - 8 string Note: positions are given in units of UTF - 8 chars
def UTF8Strsub(utf, start, len): """Create a substring from a given UTF-8 string Note: positions are given in units of UTF-8 chars """ ret = libxml2mod.xmlUTF8Strsub(utf, start, len) return ret
Pops the top XPath object from the value stack
def valuePop(ctxt): """Pops the top XPath object from the value stack """ if ctxt is None: ctxt__o = None else: ctxt__o = ctxt._o ret = libxml2mod.valuePop(ctxt__o) return ret
Remove a namespace definition from a node. If href is None remove all of the ns definitions on that node. The removed namespaces are returned as a linked list.
def removeNsDef(self, href): """ Remove a namespace definition from a node. If href is None, remove all of the ns definitions on that node. The removed namespaces are returned as a linked list. Note: If any child nodes referred to the removed namespaces, they will be l...
Register an error handler that will be called back as f ( arg msg severity reserved ).
def setErrorHandler(self,f,arg): """Register an error handler that will be called back as f(arg,msg,severity,reserved). @reserved is currently always None.""" libxml2mod.xmlParserCtxtSetErrorHandler(self._o,f,arg)
Register error and warning handlers for DTD validation. These will be called back as f ( msg arg )
def setValidityErrorHandler(self, err_func, warn_func, arg=None): """ Register error and warning handlers for DTD validation. These will be called back as f(msg,arg) """ libxml2mod.xmlSetValidErrors(self._o, err_func, warn_func, arg)
Register error and warning handlers for Schema validation. These will be called back as f ( msg arg )
def setValidityErrorHandler(self, err_func, warn_func, arg=None): """ Register error and warning handlers for Schema validation. These will be called back as f(msg,arg) """ libxml2mod.xmlSchemaSetValidErrors(self._o, err_func, warn_func, arg)
Register error and warning handlers for RelaxNG validation. These will be called back as f ( msg arg )
def setValidityErrorHandler(self, err_func, warn_func, arg=None): """ Register error and warning handlers for RelaxNG validation. These will be called back as f(msg,arg) """ libxml2mod.xmlRelaxNGSetValidErrors(self._o, err_func, warn_func, arg)
Register an error handler that will be called back as f ( arg msg severity locator ).
def SetErrorHandler(self,f,arg): """Register an error handler that will be called back as f(arg,msg,severity,locator).""" if f is None: libxml2mod.xmlTextReaderSetErrorHandler(\ self._o,None,None) else: libxml2mod.xmlTextReaderSetErrorHandler(\ ...
Return ( f arg ) as previously registered with setErrorHandler or ( None None ).
def GetErrorHandler(self): """Return (f,arg) as previously registered with setErrorHandler or (None,None).""" f,arg = libxml2mod.xmlTextReaderGetErrorHandler(self._o) if f is None: return None,None else: # assert f is _xmlTextReaderErrorFunc ...
Get the namespace of a node
def ns(self): """Get the namespace of a node """ ret = libxml2mod.xmlNodeGetNs(self._o) if ret is None:return None __tmp = xmlNs(_obj=ret) return __tmp
Get the namespace of a node
def nsDefs(self): """Get the namespace of a node """ ret = libxml2mod.xmlNodeGetNsDefs(self._o) if ret is None:return None __tmp = xmlNs(_obj=ret) return __tmp
Dumps debug information for the element node it is recursive
def debugDumpNode(self, output, depth): """Dumps debug information for the element node, it is recursive """ libxml2mod.xmlDebugDumpNode(output, self._o, depth)
Dumps debug information for the list of element node it is recursive
def debugDumpNodeList(self, output, depth): """Dumps debug information for the list of element node, it is recursive """ libxml2mod.xmlDebugDumpNodeList(output, self._o, depth)
Dumps debug information for the element node it is not recursive
def debugDumpOneNode(self, output, depth): """Dumps debug information for the element node, it is not recursive """ libxml2mod.xmlDebugDumpOneNode(output, self._o, depth)
Add a new node to
def 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 ...
Add a list of node at the end of the child list of the parent merging adjacent TEXT nodes (
def 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) """ if cur is None: cur__o = None else: cur__o = cur._o ret = libxml2mod.xmlAddChildList(self._o, cur__o) if ret is None:raise ...
Append the extra substring to the node content. NOTE: In contrast to xmlNodeSetContentLen ()
def addContentLen(self, content, len): """Append the extra substring to the node content. NOTE: In contrast to xmlNodeSetContentLen(), @content is supposed to be raw text, so unescaped XML special chars are allowed, entity references are not supported. """ libxml2mod.xmlNo...
Add a new node
def 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...
Add a new node
def 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 ...
Add a new element
def 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. """ if elem is None: elem__o = None...
Do a copy of the node.
def copyNode(self, extended): """Do a copy of the node. """ ret = libxml2mod.xmlCopyNode(self._o, extended) if ret is None:raise treeError('xmlCopyNode() failed') __tmp = xmlNode(_obj=ret) return __tmp
Do a recursive copy of the node list. Use xmlDocCopyNodeList () if possible to ensure string interning.
def copyNodeList(self): """Do a recursive copy of the node list. Use xmlDocCopyNodeList() if possible to ensure string interning. """ ret = libxml2mod.xmlCopyNodeList(self._o) if ret is None:raise treeError('xmlCopyNodeList() failed') __tmp = xmlNode(_obj=ret) return __...
Do a copy of the attribute.
def copyProp(self, cur): """Do a copy of the attribute. """ if cur is None: cur__o = None else: cur__o = cur._o ret = libxml2mod.xmlCopyProp(self._o, cur__o) if ret is None:raise treeError('xmlCopyProp() failed') __tmp = xmlAttr(_obj=ret) return __tmp
Do a copy of an attribute list.
def copyPropList(self, cur): """Do a copy of an attribute list. """ if cur is None: cur__o = None else: cur__o = cur._o ret = libxml2mod.xmlCopyPropList(self._o, cur__o) if ret is None:raise treeError('xmlCopyPropList() failed') __tmp = xmlAttr(_obj=ret) return __...
Do a copy of the node to a given document.
def docCopyNode(self, doc, extended): """Do a copy of the node to a given document. """ if doc is None: doc__o = None else: doc__o = doc._o ret = libxml2mod.xmlDocCopyNode(self._o, doc__o, extended) if ret is None:raise treeError('xmlDocCopyNode() failed') __tmp = xmlNode...
Do a recursive copy of the node list.
def docCopyNodeList(self, doc): """Do a recursive copy of the node list. """ if doc is None: doc__o = None else: doc__o = doc._o ret = libxml2mod.xmlDocCopyNodeList(doc__o, self._o) if ret is None:raise treeError('xmlDocCopyNodeList() failed') __tmp = xmlNode(_obj=ret) ...
Set the root element of the document ( doc - > children is a list containing possibly comments PIs etc... ).
def docSetRootElement(self, doc): """Set the root element of the document (doc->children is a list containing possibly comments, PIs, etc ...). """ if doc is None: doc__o = None else: doc__o = doc._o ret = libxml2mod.xmlDocSetRootElement(doc__o, self._o) if ret is None...
Finds the first child node of that element which is a Element node Note the handling of entities references is different than in the W3C DOM element traversal spec since we don t have back reference from entities content to entities references.
def firstElementChild(self): """Finds the first child node of that element which is a Element node Note the handling of entities references is different than in the W3C DOM element traversal spec since we don't have back reference from entities content to entities refere...
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 (...
def 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 ...
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. Note that a namespace of None indicates to use the d...
def 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...
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.
def 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. """ ret = libxml2mod.xmlHasProp(self._o, name) if ret is None:return None ...
Search the last child of a node.
def lastChild(self): """Search the last child of a node. """ ret = libxml2mod.xmlGetLastChild(self._o) if ret is None:raise treeError('xmlGetLastChild() failed') __tmp = xmlNode(_obj=ret) return __tmp
Finds the last child node of that element which is a Element node Note the handling of entities references is different than in the W3C DOM element traversal spec since we don t have back reference from entities content to entities references.
def lastElementChild(self): """Finds the last child node of that element which is a Element node Note the handling of entities references is different than in the W3C DOM element traversal spec since we don't have back reference from entities content to entities referenc...
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.
def 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. """ if doc is None: doc__o = None ...
Build the string equivalent to the text contained in the Node list made of TEXTs and ENTITY_REFs
def listGetString(self, doc, inLine): """Build the string equivalent to the text contained in the Node list made of TEXTs and ENTITY_REFs """ if doc is None: doc__o = None else: doc__o = doc._o ret = libxml2mod.xmlNodeListGetString(doc__o, self._o, inLine) return ret
Creation of a new child element added at the end of
def 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 c...
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.
def 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. """ ret...
Create a new property tagged with a namespace and carried by a node.
def newNsProp(self, ns, name, value): """Create a new property tagged with a namespace and carried by a node. """ if ns is None: ns__o = None else: ns__o = ns._o ret = libxml2mod.xmlNewNsProp(self._o, ns__o, name, value) if ret is None:raise treeError('xmlNewNsProp() f...
Create a new property tagged with a namespace and carried by a node.
def newNsPropEatName(self, ns, name, value): """Create a new property tagged with a namespace and carried by a node. """ if ns is None: ns__o = None else: ns__o = ns._o ret = libxml2mod.xmlNewNsPropEatName(self._o, ns__o, name, value) if ret is None:raise treeError('xm...
Create a new property carried by a node.
def newProp(self, name, value): """Create a new property carried by a node. """ ret = libxml2mod.xmlNewProp(self._o, name, value) if ret is None:raise treeError('xmlNewProp() failed') __tmp = xmlAttr(_obj=ret) return __tmp
Creation of a new child element added at the end of
def 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, ...
Finds the first closest next sibling of the node which is an element node. Note the handling of entities references is different than in the W3C DOM element traversal spec since we don t have back reference from entities content to entities references.
def nextElementSibling(self): """Finds the first closest next sibling of the node which is an element node. Note the handling of entities references is different than in the W3C DOM element traversal spec since we don't have back reference from entities content to entiti...
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.
def 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 sim...
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.
def 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 dec...
Finds the first closest previous sibling of the node which is an element node. Note the handling of entities references is different than in the W3C DOM element traversal spec since we don t have back reference from entities content to entities references.
def previousElementSibling(self): """Finds the first closest previous sibling of the node which is an element node. Note the handling of entities references is different than in the W3C DOM element traversal spec since we don't have back reference from entities content t...
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 xmlGetNsPro...
def 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...
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 t...
def 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 outsi...
Unlink the old node from its current context prune the new one at the same place. If
def 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. """ if cur is None: cur__o = None else: cur__o = cur._o ret = ...
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.
def 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 ...
Search a Ns aliasing a given URI. Recurse on the parents until it finds the defined namespace or return None otherwise.
def 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. """ if doc is None: doc__o = None else: doc__o = doc._o ret = libxml2mod.xmlSearchNsByHref(doc__o, self._o,...
Replace the content of a node. NOTE:
def setContentLen(self, content, len): """Replace the content of a node. NOTE: @content is supposed to be a piece of XML CDATA, so it allows entity references, but XML special chars need to be escaped first by using xmlEncodeEntitiesReentrant() resp. xmlEncodeSpecialChars(). """ ...
update all nodes in the list to point to the right document
def setListDoc(self, doc): """update all nodes in the list to point to the right document """ if doc is None: doc__o = None else: doc__o = doc._o libxml2mod.xmlSetListDoc(self._o, doc__o)
Associate a namespace to a node a posteriori.
def setNs(self, ns): """Associate a namespace to a node, a posteriori. """ if ns is None: ns__o = None else: ns__o = ns._o libxml2mod.xmlSetNs(self._o, ns__o)
Set ( or reset ) an attribute carried by a node. The ns structure must be in scope this is not checked
def 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 """ if ns is None: ns__o = None else: ns__o = ns._o ret = libxml2mod.xmlSetNsProp(self._o, ns__o, name, value) if ret is None:...
Set ( or reset ) an attribute carried by a node. If
def setProp(self, name, value): """Set (or reset) an attribute carried by a node. If @name has a prefix, then the corresponding namespace-binding will be used, if in scope; it is an error it there's no such ns-binding for the prefix in scope. """ ret = libxml2mod.xmlSetPro...
update all nodes under the tree to point to the right document
def setTreeDoc(self, doc): """update all nodes under the tree to point to the right document """ if doc is None: doc__o = None else: doc__o = doc._o libxml2mod.xmlSetTreeDoc(self._o, doc__o)
Concat the given string at the end of the existing node content
def textConcat(self, content, len): """Concat the given string at the end of the existing node content """ ret = libxml2mod.xmlTextConcat(self._o, content, len) return ret
Merge two text nodes into one
def textMerge(self, second): """Merge two text nodes into one """ if second is None: second__o = None else: second__o = second._o ret = libxml2mod.xmlTextMerge(self._o, second__o) if ret is None:raise treeError('xmlTextMerge() failed') __tmp = xmlNode(_obj=ret) re...
Remove an attribute carried by a node.
def unsetNsProp(self, ns, name): """Remove an attribute carried by a node. """ if ns is None: ns__o = None else: ns__o = ns._o ret = libxml2mod.xmlUnsetNsProp(self._o, ns__o, name) return ret
Remove an attribute carried by a node. This handles only attributes in no namespace.
def unsetProp(self, name): """Remove an attribute carried by a node. This handles only attributes in no namespace. """ ret = libxml2mod.xmlUnsetProp(self._o, name) return ret
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.
def 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. """ if doc is None: ...
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 ).
def 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). """ if doc is None: doc__o = None else: doc__o = doc._o if attr is None: attr__o = ...
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 singl...
def 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 an...
Implement the XInclude substitution for the given subtree
def xincludeProcessTreeFlags(self, flags): """Implement the XInclude substitution for the given subtree """ ret = libxml2mod.xmlXIncludeProcessTreeFlags(self._o, flags) return ret
Validate a branch of a tree starting with the given
def schemaValidateOneElement(self, ctxt): """Validate a branch of a tree, starting with the given @elem. """ if ctxt is None: ctxt__o = None else: ctxt__o = ctxt._o ret = libxml2mod.xmlSchemaValidateOneElement(ctxt__o, self._o) return ret
Compare two nodes w. r. t document order
def xpathCmpNodes(self, node2): """Compare two nodes w.r.t document order """ if node2 is None: node2__o = None else: node2__o = node2._o ret = libxml2mod.xmlXPathCmpNodes(self._o, node2__o) return ret
Evaluate the XPath Location Path in the given context. The node node is set as the context node. The context node is not restored.
def xpathNodeEval(self, str, ctx): """Evaluate the XPath Location Path in the given context. The node 'node' is set as the context node. The context node is not restored. """ if ctx is None: ctx__o = None else: ctx__o = ctx._o ret = libxml2mod.xmlXPathNodeEval(self._...
Create a new xmlXPathObjectPtr of type NodeSet and initialize it with the single Node
def xpathNewNodeSet(self): """Create a new xmlXPathObjectPtr of type NodeSet and initialize it with the single Node @val """ ret = libxml2mod.xmlXPathNewNodeSet(self._o) if ret is None:raise xpathError('xmlXPathNewNodeSet() failed') return xpathObjectRet(ret)
Create a new xmlXPathObjectPtr of type Value Tree ( XSLT ) and initialize it with the tree root
def xpathNewValueTree(self): """Create a new xmlXPathObjectPtr of type Value Tree (XSLT) and initialize it with the tree root @val """ ret = libxml2mod.xmlXPathNewValueTree(self._o) if ret is None:raise xpathError('xmlXPathNewValueTree() failed') return xpathObjectRet(ret)
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...
def 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 ord...
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...
def 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...
Traversal function for the attribute direction TODO: support DTD inherited default attributes
def xpathNextAttribute(self, ctxt): """Traversal function for the "attribute" direction TODO: support DTD inherited default attributes """ if ctxt is None: ctxt__o = None else: ctxt__o = ctxt._o ret = libxml2mod.xmlXPathNextAttribute(ctxt__o, self._o) if ret is None:ra...
Traversal function for the child direction The child axis contains the children of the context node in document order.
def xpathNextChild(self, ctxt): """Traversal function for the "child" direction The child axis contains the children of the context node in document order. """ if ctxt is None: ctxt__o = None else: ctxt__o = ctxt._o ret = libxml2mod.xmlXPathNextChild(ctxt__o, self._o) i...
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.
def 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. """ if ctxt is None: ctxt__o = None ...
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
def 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 ...
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
def 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 node...
Traversal function for the following - sibling direction The following - sibling axis contains the following siblings of the context node in document order.
def 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. """ if ctxt is None: ctxt__o = None else: ctxt__o = ctxt._o ret = ...
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.
def 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 ele...
Traversal function for the parent direction The parent axis contains the parent of the context node if there is one.
def xpathNextParent(self, ctxt): """Traversal function for the "parent" direction The parent axis contains the parent of the context node, if there is one. """ if ctxt is None: ctxt__o = None else: ctxt__o = ctxt._o ret = libxml2mod.xmlXPathNextParent(ctxt__o, self._...
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
def 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...
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.
def 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 ...
Traversal function for the self direction The self axis contains just the context node itself
def xpathNextSelf(self, ctxt): """Traversal function for the "self" direction The self axis contains just the context node itself """ if ctxt is None: ctxt__o = None else: ctxt__o = ctxt._o ret = libxml2mod.xmlXPathNextSelf(ctxt__o, self._o) if ret is None:raise xpathE...
Create a new xmlXPathObjectPtr of type range using a single nodes
def xpointerNewCollapsedRange(self): """Create a new xmlXPathObjectPtr of type range using a single nodes """ ret = libxml2mod.xmlXPtrNewCollapsedRange(self._o) if ret is None:raise treeError('xmlXPtrNewCollapsedRange() failed') return xpathObjectRet(ret)
Create a new XPointer context
def xpointerNewContext(self, doc, origin): """Create a new XPointer context """ if doc is None: doc__o = None else: doc__o = doc._o if origin is None: origin__o = None else: origin__o = origin._o ret = libxml2mod.xmlXPtrNewContext(doc__o, self._o, origin__o) if re...