@XMLGetContent
Syntax
@XMLGetContent(XMLN);
@XMLGetContent(XMLN;Options);
Description
This @Function retrieves the direct text content of an XML node.
Only directly contained text and CDATA nodes are included. Content from child XML elements is not included.
The content is converted to the desired character set according to the output flags set for the XML handle.
The optional Options parameter specifies whether the content is returned as text or as a binary buffer.
VSPECHXMLNODE XMLN:
Handle of the XML node whose content is to be retrieved.
XMLN must contain a valid VSPECHXMLNODE (XMLN) handle that references an XML node.
TEXT Options (Optional):
Specifies the data type of the returned attribute value.
Option : Meaning
"A" : Returns the attribute value as TEXT.
"B" : Returns the attribute value as VSPECBINBUFFER.
If Options is not specified, option "A" is used.
With option "A", the returned value must not exceed the maximum size of a text item.
With option "B", content up to a maximum size of 100 MB can be returned.
Return Value:
On successful execution, the @Function returns the direct text and CDATA content of the XML node as TEXT or VSPECBINBUFFER, depending on Options.
Multiple directly contained text or CDATA nodes are concatenated in their original order into a single result.
Text content within child XML elements is not included.
If the XML node handle is invalid, an invalid option is specified, an error occurs during character set conversion, or the permitted size is exceeded, the @Function returns @ERROR.
Example: @XMLGetContent(XMLN);
XML := "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<customer>" +
"Customer: " +
"<name>Example GmbH</name>" +
" Berlin" +
"</customer>";
hXMLD := @XMLParse(XML);
hXMLRoot := @XMLGetRoot(hXMLD);
Content := @XMLGetContent(hXMLRoot);
@XMLRelease(hXMLD);
The example retrieves only the direct text content of the root element. Content then contains "Customer: Berlin".
The content "Example GmbH" of the child "<name>" element is not included.
Example: @XMLGetContent(XMLN;Options);
XML := "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<customer><![CDATA[Example GmbH & Co. KG]]"+
"></customer>";
hXMLD := @XMLParse(XML);
hXMLRoot := @XMLGetRoot(hXMLD);
Content := @XMLGetContent(hXMLRoot;"B");
@DestroyBuffer(Content);
@XMLRelease(hXMLD);
The example retrieves the CDATA content of the XML node and returns it as a VSPECBINBUFFER.
Note : This text was machine-translated and may contain inaccuracies.
