2.2 :add()

This method appends a child node to the current DOM node. The XML Cursor then points to the newly added node.

Definition

boolean :add
(
      enum    Nodetype input
  { , string  Name   := null input }
  { , string  Value  := null input }
  { , boolean Select := true input }
)

Second Form (Microsoft Windows Only)

boolean :add
(
      pointer IXMLDOMNode input
  { , boolean Select := true input }
)

Parameters

enum Nodetype input

Type of the appended DOM node.

Value range

nodetype_attribute

The node is an attribute of an element.

nodetype_cdata_section

The node is a section with unparsed character data (CDATA).

nodetype_comment

The node is a comment.

nodetype_document

The node is a complete document.

nodetype_document_fragment

The node is a section of a document.

nodetype_document_type

The node is a document type declaration.

nodetype_element

The node is an element.

nodetype_entity

The node is an entity declaration.

nodetype_entity_reference

The node is a reference to a declared entity.

nodetype_notation

The node is a notation declared in the DTD.

nodetype_processing_instruction

The node is a processing instruction.

nodetype_text

The node is the text content of an element or an attribute value.

string Name := null input

Optional parameter that specifies the name or tag for the new DOM node. When the Nodetype parameter has one of the values from the table below, Name is ignored and a predefined name is used.

Nodetype Predefined Name

nodetype_cdata_section

#cdata-section

nodetype_comment

#comment

nodetype_document

#document

nodetype_document_fragment

#document-fragment

nodetype_text

#text

string Value := null input

Optional parameter that specifies the value of the new DOM node. Only applicable if the Nodetype parameter has one of these values:

  • nodetype_attribute
  • nodetype_cdata_section
  • nodetype_comment
  • nodetype_processing_instruction
  • nodetype_text
pointer IXMLDOMNode input
A Microsoft Windows COM object that is appended as child node. May also be aMicrosoft Windows IXMLDOMNodeList COM object, of which all XML nodes contained in the list are appended.
boolean Select := true input
Optional parameter that defines, whether the XML Cursor shall point to the newly appended DOM node. When this parameter is missing, true is used as default so that the XML Cursor is set to point to the new DOM node.

Return value

The method returns true, when the child node could be appended, false otherwise.

In case of an error the XML Cursor remains pointing to the same DOM node as before the method call.

Objects with this method

doccursor