Module xmldom

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

Consts

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

Procs

proc getDOM*(): PDOMImplementation
Returns a DOMImplementation
proc createDocument*(dom: PDOMImplementation; namespaceURI: string; 
                     qualifiedName: string): PDocument
Creates an XML Document object of the specified type with its document element.
proc createDocument*(dom: PDOMImplementation; n: PElement): PDocument
Creates an XML Document object of the specified type with its document element.
proc hasFeature*(dom: PDOMImplementation; feature: string; version: string = ""): bool
Returns true if this version of the DomImplementation implements feature, otherwise false
proc implementation*(doc: PDocument): PDOMImplementation
proc documentElement*(doc: PDocument): PElement
proc createAttribute*(doc: PDocument; name: string): PAttr
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.
proc createAttributeNS*(doc: PDocument; namespaceURI: string; 
                        qualifiedName: string): PAttr
Creates an attribute of the given qualified name and namespace URI
proc createCDATASection*(doc: PDocument; data: string): PCDATASection
Creates a CDATASection node whose value is the specified string.
proc createComment*(doc: PDocument; data: string): PComment
Creates a Comment node given the specified string.
proc createDocumentFragment*(doc: PDocument): PDocumentFragment
Creates an empty DocumentFragment object.
proc createElement*(doc: PDocument; tagName: string): PElement
Creates an element of the type specified.
proc createElementNS*(doc: PDocument; namespaceURI: string; 
                      qualifiedName: string): PElement
Creates an element of the given qualified name and namespace URI.
proc createProcessingInstruction*(doc: PDocument; target: string; data: string): PProcessingInstruction
Creates a ProcessingInstruction node given the specified name and data strings.
proc createTextNode*(doc: PDocument; data: string): PText
Creates a Text node given the specified string.
proc getElementsByTagName*(doc: PDocument; tagName: string): seq[PNode]
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.
proc getElementsByTagNameNS*(doc: PDocument; namespaceURI: string; 
                             localName: string): seq[PNode]
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.
proc importNode*(doc: PDocument; importedNode: PNode; deep: bool): PNode
Imports a node from another document to this document
proc firstChild*(n: PNode): PNode
Returns this node's first child
proc lastChild*(n: PNode): PNode
Returns this node's last child
proc localName*(n: PNode): string
Returns this nodes local name
proc namespaceURI*(n: PNode): string
Returns this nodes namespace URI
proc `namespaceURI =`*(n: PNode; value: string)
proc nextSibling*(n: PNode): PNode
Returns the next sibling of this node
proc nodeName*(n: PNode): string
Returns the name of this node
proc nodeType*(n: PNode): int
Returns the type of this node
proc ownerDocument*(n: PNode): PDocument
Returns the owner document of this node
proc parentNode*(n: PNode): PNode
Returns the parent node of this node
proc previousSibling*(n: PNode): PNode
Returns the previous sibling of this node
proc `prefix =`*(n: PNode; value: string)
Modifies the prefix of this node
proc appendChild*(n: PNode; newChild: PNode)
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.
proc cloneNode*(n: PNode; deep: bool): PNode
Returns a duplicate of this node, if deep is true, Element node's children are copied
proc hasAttributes*(n: PNode): bool
Returns whether this node (if it is an element) has any attributes.
proc hasChildNodes*(n: PNode): bool
Returns whether this node has any children.
proc insertBefore*(n: PNode; newChild: PNode; refChild: PNode): PNode
Inserts the node newChild before the existing child node refChild. If refChild is nil, insert newChild at the end of the list of children.
proc isSupported*(n: PNode; feature: string; version: string): bool
Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.
proc normalize*(n: PNode)
Merges all seperated TextNodes together, and removes any empty TextNodes
proc removeChild*(n: PNode; oldChild: PNode): PNode
Removes the child node indicated by oldChild from the list of children, and returns it.
proc replaceChild*(n: PNode; newChild: PNode; oldChild: PNode): PNode
Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
proc getNamedItem*(NList: seq[PNode]; name: string): PNode
Retrieves a node specified by name. If this node cannot be found returns nil
proc getNamedItem*(NList: seq[PAttr]; name: string): PAttr
Retrieves a node specified by name. If this node cannot be found returns nil
proc getNamedItemNS*(NList: seq[PNode]; namespaceURI: string; localName: string): PNode
Retrieves a node specified by localName and namespaceURI. If this node cannot be found returns nil
proc getNamedItemNS*(NList: seq[PAttr]; namespaceURI: string; localName: string): PAttr
Retrieves a node specified by localName and namespaceURI. If this node cannot be found returns nil
proc item*(NList: seq[PNode]; index: int): PNode
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.
proc removeNamedItem*(NList: var seq[PNode]; name: string): PNode
Removes a node specified by name Raises the ENotFoundErr exception, if the node was not found
proc removeNamedItemNS*(NList: var seq[PNode]; namespaceURI: string; 
                        localName: string): PNode
Removes a node specified by local name and namespace URI
proc setNamedItem*(NList: var seq[PNode]; arg: PNode): PNode
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.
proc setNamedItem*(NList: var seq[PAttr]; arg: PAttr): PAttr
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.
proc setNamedItemNS*(NList: var seq[PNode]; arg: PNode): PNode
Adds a node using its namespaceURI and localName
proc setNamedItemNS*(NList: var seq[PAttr]; arg: PAttr): PAttr
Adds a node using its namespaceURI and localName
proc name*(a: PAttr): string
Returns the name of the Attribute
proc specified*(a: PAttr): bool
Specifies whether this attribute was specified in the original document
proc ownerElement*(a: PAttr): PElement
Returns this Attributes owner element
proc tagName*(el: PElement): string
Returns the Element Tag Name
proc getAttribute*(el: PElement; name: string): string
Retrieves an attribute value by name
proc getAttributeNS*(el: PElement; namespaceURI: string; localName: string): string
Retrieves an attribute value by localName and namespaceURI
proc getAttributeNode*(el: PElement; name: string): PAttr
Retrieves an attribute node by name To retrieve an attribute node by qualified name and namespace URI, use the getAttributeNodeNS method
proc getAttributeNodeNS*(el: PElement; namespaceURI: string; localName: string): PAttr
Retrieves an Attr node by localName and namespaceURI
proc getElementsByTagName*(el: PElement; name: string): seq[PNode]
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
proc getElementsByTagNameNS*(el: PElement; namespaceURI: string; 
                             localName: string): seq[PNode]
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
proc hasAttribute*(el: PElement; name: string): bool
Returns true when an attribute with a given name is specified on this element , false otherwise.
proc hasAttributeNS*(el: PElement; namespaceURI: string; localName: string): bool
Returns true when an attribute with a given localName and namespaceURI is specified on this element , false otherwise
proc removeAttribute*(el: PElement; name: string)
Removes an attribute by name
proc removeAttributeNS*(el: PElement; namespaceURI: string; localName: string)
Removes an attribute by localName and namespaceURI
proc removeAttributeNode*(el: PElement; oldAttr: PAttr): PAttr
Removes the specified attribute node If the attribute node cannot be found raises ENotFoundErr
proc setAttributeNode*(el: PElement; newAttr: PAttr): PAttr
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.
proc setAttributeNodeNS*(el: PElement; newAttr: PAttr): PAttr
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.
proc setAttribute*(el: PElement; name: string; value: string)
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
proc setAttributeNS*(el: PElement; namespaceURI, localName, value: string)
Adds a new attribute, as specified by namespaceURI, localName and value.
proc splitData*(TextNode: PText; offset: int): PText
Breaks this node into two nodes at the specified offset, keeping both in the tree as siblings.
proc target*(PI: PProcessingInstruction): string
Returns the Processing Instructions target
proc `$`*(doc: PDocument): string
Converts a PDocument object into a string representation of it's XML
Generated: 2012-09-23 21:47:54 UTC