Function EN Version 10.01

@XMLNodeListGetNode

XML

Syntax

@XMLNodeListGetNode(XMLNL;Index);

Description

This @Function retrieves a specific XML node from a previously created XML node list.
The desired node is selected using a numeric index. Indexing starts at 1.
The flags inherited from the XML node list handle are also applied to the returned XML node handle.

VSPECHXMLNODELIST
XMLNL:
Handle of the XML node list from which a node is to be retrieved.
XMLNL must contain a valid VSPECHXMLNODELIST (XMLNL) handle.

FN Index:
Numeric index of the node to be returned.
The first node has index 1.
The index must be greater than 0 and must not exceed the number of nodes contained in the node list.

Return Value:
If a valid XML node is found, the @Function returns a VSPECHXMLNODE (XMLN) handle referencing the selected node.
If the index is invalid, the XML node list handle is invalid, or the selected node is not an XML element, the @Function returns @ERROR.


Example: @XMLNodeListGetNode(XMLNL;Index);

XML := "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<customers>" +
" <customer id=\"1\" />" +
" <customer id=\"2\" />" +
"</customers>";
hXMLD := @XMLParse(XML);
hXMLRoot := @XMLGetRoot(hXMLD);
hXMLNL := @XMLSelectNodes(hXMLRoot;"customer");
hCustomer := @XMLNodeListGetNode(hXMLNL;2);
CustomerID := @XMLGetAttribute(hCustomer;"A";"id");
@XMLNodeListRelease(hXMLNL);
@XMLRelease(hXMLD);

The example retrieves the second node from the node list. CustomerID then contains the value "2".

Note : This text was machine-translated and may contain inaccuracies.