Module xmldom

Search:
Group by:

This module implements XML DOM Level 2 Core specification (http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html)

Types

EDOMException = object of ValueError
Base exception object for all DOM Exceptions   Source Edit
EDOMStringSizeErr = object of EDOMException
If the specified range of text does not fit into a DOMString Currently not used(Since DOMString is just string)   Source Edit
EHierarchyRequestErr = object of EDOMException
If any node is inserted somewhere it doesn't belong   Source Edit
EIndexSizeErr = object of EDOMException
If index or size is negative, or greater than the allowed value   Source Edit
EInuseAttributeErr = object of EDOMException
If an attempt is made to add an attribute that is already in use elsewhere   Source Edit
EInvalidAccessErr = object of EDOMException
If a parameter or an operation is not supported by the underlying object.   Source Edit
EInvalidCharacterErr = object of EDOMException
This exception is raised when a string parameter contains an illegal character   Source Edit
EInvalidModificationErr = object of EDOMException
If an attempt is made to modify the type of the underlying object.   Source Edit
EInvalidStateErr = object of EDOMException
If an attempt is made to use an object that is not, or is no longer, usable.   Source Edit
ENamespaceErr = object of EDOMException
If an attempt is made to create or change an object in a way which is incorrect with regard to namespaces.   Source Edit
ENotFoundErr = object of EDOMException
If an attempt is made to reference a node in a context where it does not exist   Source Edit
ENotSupportedErr = object of EDOMException
If the implementation does not support the requested type of object or operation.   Source Edit
ENoDataAllowedErr = object of EDOMException
If data is specified for a node which does not support data   Source Edit
ENoModificationAllowedErr = object of EDOMException
If an attempt is made to modify an object where modifications are not allowed   Source Edit
ESyntaxErr = object of EDOMException
If an invalid or illegal string is specified.   Source Edit
EWrongDocumentErr = object of EDOMException
If a node is used in a different document than the one that created it (that doesn't support it)   Source Edit
PDOMImplementation = ref DOMImplementation
  Source Edit
PNode = ref Node
  Source Edit
PElement = ref Element
  Source Edit
PCharacterData = ref CharacterData
  Source Edit
PDocument = ref Document
  Source Edit
PAttr = ref Attr
  Source Edit
PDocumentFragment = ref DocumentFragment
  Source Edit
PText = ref Text
  Source Edit
PComment = ref Comment
  Source Edit
PCDataSection = ref CDataSection
  Source Edit
PProcessingInstruction = ref ProcessingInstruction
  Source Edit

Consts

ElementNode = 1
  Source Edit
AttributeNode = 2
  Source Edit
TextNode = 3
  Source Edit
CDataSectionNode = 4
  Source Edit
ProcessingInstructionNode = 7
  Source Edit
CommentNode = 8
  Source Edit
DocumentNode = 9
  Source Edit
DocumentFragmentNode = 11
  Source Edit

Procs

proc getDOM(): PDOMImplementation {...}{.raises: [], tags: [].}
Returns a DOMImplementation   Source Edit
proc createDocument(dom: PDOMImplementation; namespaceURI: string;
                   qualifiedName: string): PDocument {...}{.raises: [], tags: [].}
Creates an XML Document object of the specified type with its document element.   Source Edit
proc createDocument(dom: PDOMImplementation; n: PElement): PDocument {...}{.raises: [],
    tags: [].}
Creates an XML Document object of the specified type with its document element.   Source Edit
proc hasFeature(dom: PDOMImplementation; feature: string; version: string = ""): bool {...}{.
    raises: [], tags: [].}
Returns true if this version of the DomImplementation implements feature, otherwise false   Source Edit
proc implementation(doc: PDocument): PDOMImplementation {...}{.raises: [], tags: [].}
  Source Edit
proc documentElement(doc: PDocument): PElement {...}{.raises: [], tags: [].}
  Source Edit
proc createAttribute(doc: PDocument; name: string): PAttr {...}{.
    raises: [EInvalidCharacterErr], tags: [].}
Creates an Attr of the given name. Note that the Attr instance can then be set on an Element using the setAttributeNode method. To create an attribute with a qualified name and namespace URI, use the createAttributeNS method.   Source Edit
proc createAttributeNS(doc: PDocument; namespaceURI: string; qualifiedName: string): PAttr {...}{.
    raises: [EInvalidCharacterErr, ENamespaceErr], tags: [].}
Creates an attribute of the given qualified name and namespace URI   Source Edit
proc createCDATASection(doc: PDocument; data: string): PCDataSection {...}{.raises: [],
    tags: [].}
Creates a CDATASection node whose value is the specified string.   Source Edit
proc createComment(doc: PDocument; data: string): PComment {...}{.raises: [], tags: [].}
Creates a Comment node given the specified string.   Source Edit
proc createDocumentFragment(doc: PDocument): PDocumentFragment {...}{.raises: [], tags: [].}
Creates an empty DocumentFragment object.   Source Edit
proc createElement(doc: PDocument; tagName: string): PElement {...}{.
    raises: [EInvalidCharacterErr], tags: [].}
Creates an element of the type specified.   Source Edit
proc createElementNS(doc: PDocument; namespaceURI: string; qualifiedName: string): PElement {...}{.
    raises: [ENamespaceErr, EInvalidCharacterErr], tags: [].}
Creates an element of the given qualified name and namespace URI.   Source Edit
proc createProcessingInstruction(doc: PDocument; target: string; data: string): PProcessingInstruction {...}{.
    raises: [EInvalidCharacterErr], tags: [].}
Creates a ProcessingInstruction node given the specified name and data strings.   Source Edit
proc createTextNode(doc: PDocument; data: string): PText {...}{.raises: [], tags: [].}
Creates a Text node given the specified string.   Source Edit
proc getElementsByTagName(doc: PDocument; tagName: string): seq[PNode] {...}{.raises: [],
    tags: [].}
Returns a NodeList of all the Elements with a given tag name in the order in which they are encountered in a preorder traversal of the Document tree.   Source Edit
proc getElementsByTagNameNS(doc: PDocument; namespaceURI: string; localName: string): seq[
    PNode] {...}{.raises: [], tags: [].}
Returns a NodeList of all the Elements with a given localName and namespaceURI in the order in which they are encountered in a preorder traversal of the Document tree.   Source Edit
proc importNode(doc: PDocument; importedNode: PNode; deep: bool): PNode {...}{.
    raises: [ENotSupportedErr], tags: [].}
Imports a node from another document to this document   Source Edit
proc firstChild(n: PNode): PNode {...}{.raises: [], tags: [].}
Returns this node's first child   Source Edit
proc lastChild(n: PNode): PNode {...}{.raises: [], tags: [].}
Returns this node's last child   Source Edit
proc localName(n: PNode): string {...}{.raises: [], tags: [].}
Returns this nodes local name   Source Edit
proc namespaceURI(n: PNode): string {...}{.raises: [], tags: [].}
Returns this nodes namespace URI   Source Edit
proc namespaceURI=(n: PNode; value: string) {...}{.raises: [], tags: [].}
  Source Edit
proc nextSibling(n: PNode): PNode {...}{.raises: [], tags: [].}
Returns the next sibling of this node   Source Edit
proc nodeName(n: PNode): string {...}{.raises: [], tags: [].}
Returns the name of this node   Source Edit
proc nodeType(n: PNode): int {...}{.raises: [], tags: [].}
Returns the type of this node   Source Edit
proc ownerDocument(n: PNode): PDocument {...}{.raises: [], tags: [].}
Returns the owner document of this node   Source Edit
proc parentNode(n: PNode): PNode {...}{.raises: [], tags: [].}
Returns the parent node of this node   Source Edit
proc previousSibling(n: PNode): PNode {...}{.raises: [], tags: [].}
Returns the previous sibling of this node   Source Edit
proc prefix=(n: PNode; value: string) {...}{.raises: [EInvalidCharacterErr, ENamespaceErr],
                                   tags: [].}
Modifies the prefix of this node   Source Edit
proc appendChild(n: PNode; newChild: PNode) {...}{.raises: [EHierarchyRequestErr,
    EWrongDocumentErr, ENoModificationAllowedErr], tags: [].}
Adds the node newChild to the end of the list of children of this node. If the newChild is already in the tree, it is first removed.   Source Edit
proc cloneNode(n: PNode; deep: bool): PNode {...}{.raises: [], tags: [].}
Returns a duplicate of this node, if deep is true, Element node's children are copied   Source Edit
proc hasAttributes(n: PNode): bool {...}{.raises: [], tags: [].}
Returns whether this node (if it is an element) has any attributes.   Source Edit
proc hasChildNodes(n: PNode): bool {...}{.raises: [], tags: [].}
Returns whether this node has any children.   Source Edit
proc insertBefore(n: PNode; newChild: PNode; refChild: PNode): PNode {...}{.
    raises: [EWrongDocumentErr], tags: [].}
Inserts the node newChild before the existing child node refChild. If refChild is nil, insert newChild at the end of the list of children.   Source Edit
proc isSupported(n: PNode; feature: string; version: string): bool {...}{.raises: [], tags: [].}
Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.   Source Edit
proc normalize(n: PNode) {...}{.raises: [], tags: [].}
Merges all separated TextNodes together, and removes any empty TextNodes   Source Edit
proc removeChild(n: PNode; oldChild: PNode): PNode {...}{.raises: [ENotFoundErr], tags: [].}
Removes the child node indicated by oldChild from the list of children, and returns it.   Source Edit
proc replaceChild(n: PNode; newChild: PNode; oldChild: PNode): PNode {...}{.
    raises: [EWrongDocumentErr, ENotFoundErr], tags: [].}
Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.   Source Edit
proc getNamedItem(nList: seq[PNode]; name: string): PNode {...}{.raises: [], tags: [].}
Retrieves a node specified by name. If this node cannot be found returns nil   Source Edit
proc getNamedItem(nList: seq[PAttr]; name: string): PAttr {...}{.raises: [], tags: [].}
Retrieves a node specified by name. If this node cannot be found returns nil   Source Edit
proc getNamedItemNS(nList: seq[PNode]; namespaceURI: string; localName: string): PNode {...}{.
    raises: [], tags: [].}
Retrieves a node specified by localName and namespaceURI. If this node cannot be found returns nil   Source Edit
proc getNamedItemNS(nList: seq[PAttr]; namespaceURI: string; localName: string): PAttr {...}{.
    raises: [], tags: [].}
Retrieves a node specified by localName and namespaceURI. If this node cannot be found returns nil   Source Edit
proc item(nList: seq[PNode]; index: int): PNode {...}{.raises: [], tags: [].}
Returns the index th item in the map. If index is greater than or equal to the number of nodes in this map, this returns nil.   Source Edit
proc removeNamedItem(nList: var seq[PNode]; name: string): PNode {...}{.
    raises: [ENotFoundErr], tags: [].}
Removes a node specified by name Raises the ENotFoundErr exception, if the node was not found   Source Edit
proc removeNamedItemNS(nList: var seq[PNode]; namespaceURI: string; localName: string): PNode {...}{.
    raises: [ENotFoundErr], tags: [].}
Removes a node specified by local name and namespace URI   Source Edit
proc setNamedItem(nList: var seq[PNode]; arg: PNode): PNode {...}{.
    raises: [EWrongDocumentErr], tags: [].}
Adds arg as a Node to the NList If a node with the same name is already present in this map, it is replaced by the new one.   Source Edit
proc setNamedItem(nList: var seq[PAttr]; arg: PAttr): PAttr {...}{.
    raises: [EWrongDocumentErr, EInuseAttributeErr], tags: [].}
Adds arg as a Node to the NList If a node with the same name is already present in this map, it is replaced by the new one.   Source Edit
proc setNamedItemNS(nList: var seq[PNode]; arg: PNode): PNode {...}{.
    raises: [EWrongDocumentErr], tags: [].}
Adds a node using its namespaceURI and localName   Source Edit
proc setNamedItemNS(nList: var seq[PAttr]; arg: PAttr): PAttr {...}{.
    raises: [EWrongDocumentErr, EInuseAttributeErr], tags: [].}
Adds a node using its namespaceURI and localName   Source Edit
proc name(a: PAttr): string {...}{.raises: [], tags: [].}
Returns the name of the Attribute   Source Edit
proc specified(a: PAttr): bool {...}{.raises: [], tags: [].}
Specifies whether this attribute was specified in the original document   Source Edit
proc ownerElement(a: PAttr): PElement {...}{.raises: [], tags: [].}
Returns this Attributes owner element   Source Edit
proc tagName(el: PElement): string {...}{.raises: [], tags: [].}
Returns the Element Tag Name   Source Edit
proc getAttribute(el: PNode; name: string): string {...}{.raises: [], tags: [].}
Retrieves an attribute value by name   Source Edit
proc getAttributeNS(el: PNode; namespaceURI: string; localName: string): string {...}{.
    raises: [], tags: [].}
Retrieves an attribute value by localName and namespaceURI   Source Edit
proc getAttributeNode(el: PElement; name: string): PAttr {...}{.raises: [], tags: [].}
Retrieves an attribute node by name To retrieve an attribute node by qualified name and namespace URI, use the getAttributeNodeNS method   Source Edit
proc getAttributeNodeNS(el: PElement; namespaceURI: string; localName: string): PAttr {...}{.
    raises: [], tags: [].}
Retrieves an Attr node by localName and namespaceURI   Source Edit
proc getElementsByTagName(el: PElement; name: string): seq[PNode] {...}{.raises: [], tags: [].}
Returns a NodeList of all descendant Elements of el with a given tag name, in the order in which they are encountered in a preorder traversal of this Element tree If name is *, returns all descendant of el   Source Edit
proc getElementsByTagNameNS(el: PElement; namespaceURI: string; localName: string): seq[
    PNode] {...}{.raises: [], tags: [].}
Returns a NodeList of all the descendant Elements with a given localName and namespaceURI in the order in which they are encountered in a preorder traversal of this Element tree   Source Edit
proc hasAttribute(el: PElement; name: string): bool {...}{.raises: [], tags: [].}
Returns true when an attribute with a given name is specified on this element , false otherwise.   Source Edit
proc hasAttributeNS(el: PElement; namespaceURI: string; localName: string): bool {...}{.
    raises: [], tags: [].}
Returns true when an attribute with a given localName and namespaceURI is specified on this element , false otherwise   Source Edit
proc removeAttribute(el: PElement; name: string) {...}{.raises: [], tags: [].}
Removes an attribute by name   Source Edit
proc removeAttributeNS(el: PElement; namespaceURI: string; localName: string) {...}{.
    raises: [], tags: [].}
Removes an attribute by localName and namespaceURI   Source Edit
proc removeAttributeNode(el: PElement; oldAttr: PAttr): PAttr {...}{.
    raises: [ENotFoundErr], tags: [].}
Removes the specified attribute node If the attribute node cannot be found raises ENotFoundErr   Source Edit
proc setAttributeNode(el: PElement; newAttr: PAttr): PAttr {...}{.
    raises: [EWrongDocumentErr, EInuseAttributeErr], tags: [].}
Adds a new attribute node, if an attribute with the same nodeName is present, it is replaced by the new one and the replaced attribute is returned, otherwise nil is returned.   Source Edit
proc setAttributeNodeNS(el: PElement; newAttr: PAttr): PAttr {...}{.
    raises: [EWrongDocumentErr, EInuseAttributeErr], tags: [].}
Adds a new attribute node, if an attribute with the localName and namespaceURI of newAttr is present, it is replaced by the new one and the replaced attribute is returned, otherwise nil is returned.   Source Edit
proc setAttribute(el: PElement; name: string; value: string) {...}{.
    raises: [EInvalidCharacterErr, EWrongDocumentErr, EInuseAttributeErr], tags: [].}
Adds a new attribute, as specified by name and value If an attribute with that name is already present in the element, its value is changed to be that of the value parameter Raises the EInvalidCharacterErr if the specified name contains illegal characters   Source Edit
proc setAttributeNS(el: PElement; namespaceURI, localName, value: string) {...}{.raises: [
    EInvalidCharacterErr, ENamespaceErr, EWrongDocumentErr, EInuseAttributeErr],
    tags: [].}
Adds a new attribute, as specified by namespaceURI, localName and value.   Source Edit
proc splitData(textNode: PText; offset: int): PText {...}{.raises: [EIndexSizeErr], tags: [].}
Breaks this node into two nodes at the specified offset, keeping both in the tree as siblings.   Source Edit
proc target(pi: PProcessingInstruction): string {...}{.raises: [], tags: [].}
Returns the Processing Instructions target   Source Edit
proc escapeXml(s: string; result: var string) {...}{.raises: [], tags: [].}
Prepares a string for insertion into a XML document by escaping the XML special characters.   Source Edit
proc escapeXml(s: string): string {...}{.raises: [], tags: [].}
Prepares a string for insertion into a XML document by escaping the XML special characters.   Source Edit
proc `$`(doc: PDocument): string {...}{.raises: [], tags: [].}
Converts a PDocument object into a string representation of it's XML   Source Edit