spacer
Yehuda Shiran February 6, 2002
Particular-Type Node Generation
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

The DOMDocument object exposes both the generic createNode() method as well as methods to create particular-type nodes, such as the createElement() method. Creating an element with this method is the same as creating a node with createNode() where the type is "element" and no namespace is specified. In order to create a namespace-qualified attribute, use the createNode() method. You can only set the name of the element with createElement(). Set the text property of the node to set the content of the element.

Notice that when you create the element object, it is not automatically connected to the current document's tree. Its ownerDocument property is equal to the document object, but its parentNode property is null. Use one of the three inserting methods to hook the new element object to the document tree: insertBefore(), replaceChild(), or appendChild().


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