Skip to main content
Version: Next

DOM Find XML element by ID

DOM Find XML element by ID ( elementRef ; id ) -> Function result

ParameterTypeDescription
elementRefString🡒XML element reference
idString🡒Value of ID attribute of element to look for
Function resultString🡐Reference of the element found (if applicable)

Description

The DOM Find XML element by ID command searches within an XML document for the element whose id attribute equals the value passed in the id parameter.

In elementRef, pass the reference of an element in the XML document where you want to perform the search. You can pass the reference of the root element or any other element; the search does not take the position of elementRef into account and always searches the whole document.

The command returns the XML reference of the element found as a result.

Warning: In XML, the id attribute associates a unique ID to each document element. The value of the id attribute must be a valid XML name and it must be unique among all the elements in the XML document (validity constraint). In order for the DOM Find XML element by ID command to work properly, this constraint must be complied with; otherwise, the result is random (the command returns the reference to the first element found in the document).

See also

DOM Find XML element