Required Parameters
- map:*: A set of one or more inputs where the name of the mapped parameter precedes the colon (for example,
map:foo), and the value is the xpath to the desired xml element in the document. See Examples for more information.
Optional Parameters
- uri: An XML file URI. This can be a dynamic file reference such as
FilePathfor the input file, a static filepath on disk, or a public URL for an XML file. - handle: A readable handle reference to the XML data. This handle is created by the xmlOpen operation and is only necessary when the target XML is not an input file. See xmlOpen for details and examples.
- repeatelement#: The xpath to an element that is repeated in the document.
- repeatmode: Defines the way in which the
repeatelement#values are stored on the output item. The allowed values areITEMandARRAY. When set toITEM(the default), the values found from the repeat element are stored as individual attributes on each output item the operation produces. When set toARRAY, the values found from the repeat element are stored as array attributes on a single output item and need to be accessed via their 1-based index (for example,[result.color#2]would refer to the second value in thecolorattribute of the result item).
Output Attributes
- *: The output values from the XML elements mapped using the map parameter. These are accessed by referencing the output item and the name of the mapped input item (for example,
[results.foo]). The name of the output item (resultsin this case) is determined by the user. See Examples for additional context.
Examples
Retrieve Values from an XML Document
Consider the XML data below, which is passed as input data to a Script Connector in :make and model of the car in this data and add them as headers to a message in Arc. The Script code below shows an example of how to do this.
Access a Specific Repeated XML Element Using its Index
Users often need to access a specific repeated XML Element. For example, you might want to access theid of the second order present in the following XML, which is passed as an input file to a Script connector.
id of a specific order using the 1-based xpath to an element present in one of the repeated <orders> elements. The following Script code shows an example of how to do this.
Use the repeatelement Parameter
Consider the XML data below, which is passed as an input file to a Script Connector:repeatelement# parameter is used to define the element that has repeating values. In this example the color and example values are repeated in the /Items/colors XML elements. When you set repeatelement#, the xmlDOMGet operation loops over the values that are present in that element.
The repeatmode parameter defines the way in which the repeatelement# values are stored as output. When set to ITEM (the default), the values found by the repeat element are stored as individual attributes on the output item. When set to ARRAY, the values found by the repeat element are stored as array attributes on the output item and need to be accessed via their 1-based index (for example, [result.color#2] would resolve to red and result.example#2 would resolve to apple).