Function EN Version 10.01

@XMLGetPrefix

XML

Syntax

@XMLGetPrefix(XMLN);

Description

This @Function retrieves the namespace prefix of an XML node.
The supplied handle must contain a valid VSPECHXMLNODE (XMLN) handle. If a namespace with a prefix is associated with the node, the prefix is returned as text.
If character set conversion is enabled for the XML handle, the returned prefix is converted accordingly.

VSPECHXMLNODE XMLN:
Handle of the XML node whose namespace prefix is to be retrieved.
XMLN must contain a valid VSPECHXMLNODE (XMLN) handle that references an XML node.

Return-Wert:
On successful execution, the namespace prefix of the XML node is returned as text.
If no namespace prefix is associated with the XML node, an empty text value is returned.
If the XML node handle is invalid or an error occurs during character set conversion, the @Function returns @ERROR.

Example: @XMLGetPrefix(XMLN);

XML := "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<c:customer xmlns:c=\"https://example.com/customer\">" +
" <c:name>Example GmbH</c:name>" +
"</c:customer>";

hXMLD := @XMLParse(XML);
hXMLRoot := @XMLGetRoot(hXMLD);
Prefix := @XMLGetPrefix(hXMLRoot);
@XMLRelease(hXMLD);

The example retrieves the namespace prefix of the root element. Prefix then contains the value "c".

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