Progress
Language Reference


CREATE-NODE( ) Method

Create an XML node in the current document. The first parameter must be a valid X-NODEREF handle and will refer to the new XML node if the method succeeds. This method merely creates the XML node as part of the XML document. The INSERT-BEFORE or APPEND-CHILD methods are required to actually insert it into the document’s tree.

Return Type: LOGICAL

Applies To: X-document Object Handle

SYNTAX
CREATE-NODE( x-node-handle , name , type ) 

x-node-handle

A valid X-NODEREF handle to use for the new XML node.

name

A character expression representing the NAME of the node. The relationship between the node NAME and SUBTYPE attributes is shown in Table 51 below.

type

A character expression representing the node’s SUBTYPE, which will be one of: ATTRIBUTE, CDATA-SECTION, COMMENT, DOCUMENT-FRAGMENT, ELEMENT, ENTITY-REFERENCE, PROCESSING-INSTRUCTION, TEXT.

Table 51: Relationship Between the SUBTYPE Attribute and the NAME Attribute
If the SUBTYPE is . . .
then the NAME attribute is . . .
ATTRIBUTE
the name of the attribute.
CDATA-SECTION
COMMENT
DOCUMENT-FRAGMENT
TEXT
a constant value; the name parameter is ignored.
ELEMENT
the name of the XML tag, with any namespace prefix included.
ENTITY-REFERENCE
the name of the entity referenced without leading ampersand and trailing semicolon.
PROCESSING-INSTRUCTION
the target; the first token following the <? markup.

The following example demonstrates creating a node in a document. If hDoc is an X-DOCUMENT handle, and hNoderef and hNoderefChild are X-NODEREFs, this is how you would add hNoderefChild to hNoderef in the document associated with hDoc:

/* Assume hNoderef has previously been added to the tree */
/* Create a 4GL handle that can refer to a node in an XML parse tree.*/
CREATE X-NODEREF hNoderefChild.

/* Create an XML node whose name is "Address" & whose type is "ELEMENT"*/
hDoc:CREATE-NODE(hNoderefChild,"Address","ELEMENT")

/* Put this child into the tree and ultimately into the document. */
hNoderef:APPEND-CHILD(hNoderefChild). 


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095