|
|
 |
To add a node to the XML tree, use the createNode() method. The syntax of the method is as follows:
createNode(type, name, namespaceURI)
where:
type is a value that uniquely identifies the node type. It can be specified by an integer between 1 and 12, or by a string identical to the nodeTypeString property of the node. For example, to create a node of type attribute, set type to 2 or "attribute".
name is a string containing the new node's desired nodeName property. You cannot set the name of all node types. Some node types enforce a constant string as their node name. The day before yesterday we listed all node types and the restrictions on their names. For example, node type 11 ("documentfragment") has a fixed name ("#document-fragment") which you cannot change. Specify an empty string for such node types (""). Non-empty strings will be ignored.
namespaceURI is a string defining the namespace Uniform Resource Identifier (URI). If specified, the node will be created in the context of the namespaceURI, including any prefix specified with the node name. If a prefix is not specified, the default namespace is used. When namespaceURI is the empty string, "", the node is created within the special namespace of the current document.
People who read this tip also read these tips:
Look for similar tips by subject:
|