Salesforce

XMLModify (Magic xpa 2.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

XMLModify (Magic xpa 2.x)

Lets you modify the value of an XML element or attribute.

Syntax:

XMLModify (generation, device, element path, attribute name, value, [,auto convert])

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 entry in the current task.

element path – A string representing the XML element path. The XML element path syntax is:
/element name[[index]] [/element name[[index]]…]

where:

element name is the name of an XML element. You can assign an alias that 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 – A string representing the attribute name that is modified. If this parameter has an empty string, the value of the XML element is modified.

value – An Alpha string with the actual value of the XML element or attribute.

auto-convert (optional) - Enter one of the following logical values:

  • True - Converts the value into a valid XML string, which has the same effect as the XMLVal function.

  • False - Does not convert the value into an XML string.

Returns:

A numeric value. 0 is returned when the XML element or attribute path modification has been successful. When the function fails, Magic xpa returns one of the following error codes:

-1 – Invalid I/O file

-2 – Inserted element or attribute alias is not defined

-3 – The I/O file not opened in Write mode

-4 – Element path not found

-5 – Attribute not found

-10 – Invalid auto convert flag

-11 – Invalid path, non-valid index

-20 – Invalid XML file (XML parsing failed)

For a full list of error codes, see XML Error Codes.

Note:

This function will redecorate the XML with spaces.

Exceptions:

This function is not supported for Rich Client tasks.

Example:

XML Modify Examples

See also:

XML Namespaces

XML Error Codes

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 and RXM12)

Reference
Attachment 
Attachment