@XMLGetRoot
Syntax
@XMLGetRoot(XMLD);
Description
This @Function retrieves the root element of a previously parsed XML document.
The supplied XML document must contain a valid VSPECHXMLDOC (XMLD) handle. The function returns a VSPECHXMLNODE (XMLN) handle that references the root element of the XML document.
The flags inherited from the XML document are also applied to the returned XML node handle.
VSPECHXMLDOC XMLD:
Handle of the XML document structure whose root element is to be retrieved.
XMLD must contain a valid VSPECHXMLDOC (XMLD) handle that references an XML document structure.
Return Value:
If no valid root element can be retrieved, the @Function returns @ERROR.
Otherwise, a VSPECHXMLNODE (XMLN) handle is returned that references the root element of the XML document.
Errors:
If the supplied XML document handle is invalid, an appropriate error is returned.
If the XML document does not contain a root element, the following error is generated:
"XML DOCUMENT HAS NO ROOT ELEMENT"
Example: @XMLGetRoot(XMLD);
XML := "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<customer>" +
" <name>Example GmbH</name>" +
" <city>Berlin</city>" +
"</customer>";
hXMLD := @XMLParse(XML);
hXMLRoot := @XMLGetRoot(hXMLD);
@XMLRelease(hXMLD);
The example reads an XML document, retrieves its root element "<customer>", and then releases the XML structure.
Note : This text was machine-translated and may contain inaccuracies.
