February 4, 2002 - Creating New XML Tree Nodes
![]() |
February 4, 2002 Creating New XML Tree Nodes Tips: February 2002
Yehuda Shiran, Ph.D.
|
createNode() method. The syntax of the method is as follows:
createNode(type, name, namespaceURI)
where:
typeis a value that uniquely identifies the nodetype. It can be specified by an integer between1and12, or by a string identical to thenodeTypeStringproperty of the node. For example, to create a node of typeattribute, settypeto2or"attribute".nameis a string containing the new node's desirednodeNameproperty. 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 type11("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.namespaceURIis a string defining the namespace Uniform Resource Identifier (URI). If specified, the node will be created in the context of thenamespaceURI, including any prefix specified with the node name. If a prefix is not specified, the default namespace is used. WhennamespaceURIis the empty string,"", the node is created within the special namespace of the current document.


Find a programming school near you