Salesforce

XMLGet (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

XMLGet (Magic xpa 3.x)

Returns the value of an XML element or an XML attribute according to its element path.

Syntax:

XMLGet(generation, device, element path, attribute name, check exists)

Parameters:

generation: A number that represents the task's hierarchic position in the runtime task tree. 0 represents the current task, 1 its immediate ancestor, and so on.

device: A number that represents the sequence number of the I/O device in the current task.

element path: A string that represents the path of an XML element. The syntax is:
/element name[[index]] [/element name[[index]]...]

where:

element name is the name of an XML element. You can assign an alias to the element name. The alias is separated from the element name by a colon symbol (:), for example, al1:My_Element.

index is the index of a specified occurrence of an element that has multiple occurrences. The index value must be greater than 0. Negative values are invalid.

attribute name: The name of the XML attribute.

check exists: (optional). Lets you know whether the function found the requested element/attribute.

Returns:

If the XML parsing process is completed successfully, the requested element will return an Alpha value. If the XML parsing process was not successful, the function will return the following: If the check exists parameter is True, then the function will return NULL. If the check exists parameter is False or not specified, then the function will return an empty string.

Note:

  • The XMLGet function supports CDATA content. To write a CDATA portion in an XML tag, place the entire CDATA sequence as the tag’s value.

  • When using XMLGet to fetch an attribute value, if the attribute name is not prefixed with an alias, Magic xpa tries to fetch the value without specifying a namespace and if no such attribute is found then Magic xpa tries to fetch it again using the same namespace URI of its container element. If the second try fails, then all attributes of the container element are scanned one by one and the first one that matches the attribute name is used for fetching the attribute value.

  • When using the XMLGet function, commented lines in the XML response are automatically removed. This is the definition, because comments are not part of the data structure (they are not defined in the schema). Therefore, the XML parser ignores them. Using the commented lines can be achieved by including them in an element instead of commenting them.

Example:

XMLGet Example

Exceptions:

This function is not supported for Rich Client tasks.

See also:

XML Namespaces

XML Error Codes

XMLBlobGet

How Do I Retrieve / Update / Insert Data According to a Certain Path in an XML Document?

The Online and Rich Client Samples projects (program XM12, XM15, RXM12 and RXM15)

Reference
Attachment 
Attachment