Skip to main content
Version: 20 R7 BETA

DOM SET XML ELEMENT NAME

DOM SET XML ELEMENT NAME ( elementRef ; elementName )

ParameterTypeDescription
elementRefTextXML element reference
elementNameTextNew name of element

Description

The DOM SET XML ELEMENT NAME command modifies the name of the element set by elementRef.

Pass the reference of the element to rename in elementRef and the new name of the element in elementName. The command also takes charge of updating the open and close tags of the element.

Example

In the following XML source:

<Book>
   <Title>The Best Seller</Title>
</Book>

If the following code is executed, with vElemRef containing the reference to the ‘Book’ element:

 DOM SET XML ELEMENT NAME(vElemRef;"BestSeller")

We get:

<BestSeller>
   <Title>The Best Seller</Title>
</BestSeller>

System variables and sets

If the command was executed correctly, the system variable OK is set to 1. Otherwise, it is set to 0 and an error is generated.

Error management

An error is generated when:

  • The element reference is invalid
  • The new name of the element to create is invalid (for example, if it starts with a number).

See also

DOM GET XML ELEMENT NAME