spacer
Yehuda Shiran February 4, 2002
Creating New XML Tree Nodes
Tips: February 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

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:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint