Initializes a new instance of the XmlDocument class.
The name of the root element.
Gets the parent of this node.
The parent of this node.
Gets this node's children.
Throws an exception if this node cannot have any children. Consult the appropriate subclass documentation for more details.
This node's children.
Inserts a new comment at the specified index. If no index is specified, the node is inserted at the end of this node's children.
The data of the comment.
The index at which the node should be inserted. If no index is specified, the node is inserted at the end of this node's children.
The newly created element.
Inserts a new XML declaration at the beginning of this node's children.
The options associated with the XML declaration.
The newly created XML declaration.
Inserts a new XML document type definition. Unless a different index is specified, the node is inserted immediately after the XML declaration if one exists, or at the beginning of this node's children if one does not.
The name of the DTD.
The system identifier of the DTD, excluding quotation marks.
The public identifier of the DTD, excluding quotation marks. If a public identifier is provided, a system identifier must be provided as well.
The index at which the node should be inserted. If no index is specified, the node is inserted immediately after the XML declaration if one exists, or at the beginning of this node's children if one does not.
The newly created XML document type definition.
Inserts the specified node into this node's children at the specified index. The node is not inserted if it is already present. If this node already has a parent, it is removed from that parent.
Only XmlComment, XmlDecl, XmlDtd, or XmlProcInst nodes can be inserted. Furthermore, XmlDecl and XmlDtd nodes must be inserted in that order and must precede the XmlElement node. In addition, XmlComment or XmlProcInst nodes must follow the XmlDecl node.
The node to insert.
The index at which to insert the node. Nodes at or after the index are shifted to the right. If no index is specified, the node is inserted at the end.
The node inserted into this node's children, or undefined if no node was inserted.
Gets the node that follows this one, or undefined if no such node exists or if this node has no parent.
The node that follows this one, or undefined if no such node exists or if this node has no parent.
Gets the node that is previous to this one, or undefined if no such node exists or if this node has no parent.
The node that is previous to this one, or undefined if no such node exists or if this node has no parent.
Inserts a new processing instruction at the specified index. If no index is specified, the node is inserted at the end of this node's children.
The target of the processing instruction.
The data of the processing instruction, or undefined if there is no target.
The index at which the node should be inserted. If no index is specified, the node is inserted at the end of this node's children.
The newly created processing instruction.
Removes this node from its parent if this node has a parent.
This node's parent, or undefined if it has no parent.
Removes the specified node from this node's children.
Note that XmlElement nodes cannot be removed from this node; attempts to do so will result in an exception being thrown.
The node to remove.
Whether a node was removed.
Removes the node at the specified index from this node's children.
Note that XmlElement nodes cannot be removed from this node; attempts to do so will result in an exception being thrown.
The index at which the node to be removed is located.
The node that was removed, or undefined if no node was removed.
Returns the root element of this document.
The root element of this document.
Returns an XML string representation of this node.
An XML string representation of this node.
Returns the root node of the current hierarchy. If this node has no parent, this node itself is returned.
The root node of the current hierarchy.
Gets the parent of this node.
Generated using TypeDoc
Represents an XML document.
A sample XML document is structured as follows:
<?xml version="1.0" encoding="UTF-8"?> <DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>My page title</title> </head> <body> <h1>Welcome!</h1> <p>I hope you enjoy visiting my website.</p> <img src="picture.png"/> </body> </html>
Each component of the document, such as the XML declaration, document type definition, and root element, are children of this node.
XmlDocument nodes must have exactly one XmlElement child, which is the document's root element.
XmlDocument nodes can have exactly one XmlDecl and XmlDtd child in that order, so long as they precede the XmlElement node.
XmlDocument nodes can have an unlimited number of XmlComment or XmlProcInst nodes, so long as they follow the XmlDecl node, if one exists.