Class Document
XML DOM Document Interface.
See the Document and Node interfaces.
Tables
Document.properties | Properties of the Document class, beyond the Node class |
Methods
Tables
- Document.properties
-
Properties of the Document class, beyond the Node class
Fields:
- doctype the DocumentType associated with this Document (readonly)
- implementation the DOMImplementation from which the Document was created (readonly)
- documentElement the root Element object of the Document (readonly)
- inputEncoding the input encoding at parse time (DOM level 3 property, readonly)
- xmlEncoding the encoding in the document, always "UTF-8" (DOM level 3 property, readonly)
- xmlStandalone whether the document is standalone (DOM level 3 property)
- xmlVersion the xml version for the document, must be '1.0' (DOM level 3 property)
Methods
- Document:adoptNode (source)
-
Not implemented. Adopts a node (DOM 3 method) into the current document, implements adoptNode.
Parameters:
Returns:
-
the adopted Node or nil+err
- Document:createAttribute (name)
-
Creates a plain Attribute node, implements createAttribute.
Parameters:
- name string attribute name.
Returns:
-
new Attribute node
- Document:createAttributeNS (namespaceURI, qualifiedName)
-
Creates a namespaced Attribute node, implements createAttributeNS.
Parameters:
- namespaceURI string the namespaceURI for the Attribute.
- qualifiedName string the qualified attribute name.
Returns:
-
new Attribute node
- Document:createCDATASection (data)
-
Creates a CDATASection node, implements createCDATASection.
Parameters:
- data string the CData contents.
Returns:
-
new CDATASection node
- Document:createComment (data)
-
Creates a Comment node, implements createComment.
Parameters:
- data string the comment.
Returns:
-
new Comment node
- Document:createDocumentFragment ()
-
Creates a DocumentFragment node, implements createDocumentFragment.
Returns:
-
new DocumentFragment node
- Document:createElement (tagName)
-
Creates a Element node, implements createElement.
Parameters:
Returns:
-
new Element node
- Document:createElementNS (namespaceURI, qualifiedName)
-
Creates a namespaced Element node, implements createElementNS.
Parameters:
- namespaceURI string the namespaceURI for the Element.
- qualifiedName string the qualified element name.
Returns:
-
new Element node
- Document:createEntityReference (name)
-
Not implemeneted. Creates a
EntityReference
node, implements createEntityReference.Parameters:
- name string the entity reference name.
Returns:
-
new
EntityReference
node - Document:createProcessingInstruction (target, data)
-
Creates a ProcessingInstruction node, implements createProcessingInstruction.
Parameters:
Returns:
-
new ProcessingInstruction node
- Document:createTextNode (data)
-
Creates a Text node, implements createTextNode.
Parameters:
Returns:
-
new Text node
- Document:getElementById (elementId)
-
Not implemented. Returns a child matching the name, implements getElementById.
Parameters:
- elementId
string
the
id
value to search for.
Returns:
-
the matching Element node
- elementId
string
the
- Document:getElementsByTagName (name)
-
Returns a list of children matching the name, implements getElementsByTagName.
The search is done recursively over the full depth, in a preorder traversal,
and this will be the order of the elements in the returned NodeList.
Parameters:
Returns:
-
NodeList with children with the requested name.
- Document:getElementsByTagNameNS (namespaceURI, localName)
-
Returns a list of children matching the namespace, implements getElementsByTagNameNS.
The search is done recursively over the full depth, in a preorder traversal,
and this will be the order of the elements in the returned NodeList.
Parameters:
- namespaceURI
string
Element namespace URI to search for, or
"*"
to match all. - localName
string
Element localname to search for, or
"*"
to match all.
Returns:
-
NodeList with children with the requested namespace.
- namespaceURI
string
Element namespace URI to search for, or
- Document:importNode (importedNode, deep)
-
Not implemented. Clones and imports the node, implements importNode.
Parameters:
- importedNode Node the Node to import from another Document.
- deep
bool
if
true
create a recursive copy.
Returns:
-
the newly cloned and imported Node, or nil+err
- Document:normalizeDocument (source)
-
Not implemented. Normalizes the document (DOM 3 method), implements normalizeDocument.
Parameters:
Returns:
-
the normalized Document or nil+err
- Document:renameNode (n, namespaceURI, qualifiedName)
-
Not implemented. Rename a node (DOM 3 method), implements importNode.
Parameters:
- n
Attr or Element
the
Attr
or Element node to rename. - namespaceURI string the new namespaceUri.
- qualifiedName string the new name.
Returns:
-
the updated Node or nil+err
- n
Attr or Element
the
- Document:write ([buffer[, namespacesInScope]])
-
exports the XML.
Parameters:
- buffer array an array to which the chunks can be added. (optional)
- namespacesInScope table namespaceURIs indexed by prefix. For any namespace not in this table, the definitions will be generated. (optional)
Returns:
-
the buffer array