Retrieving property values from external files
You can specify that a property takes a value from an XML or JSON file over HTTP. Then, when you run the process, the server prompts you with a list of values from that file.
The simplest way to format the file is
to provide a simple list of values for the property, as in the following
examples:
<company>
<employee>Alice</employee>
<employee>Bob</employee>
<employee>Chris</employee>
<company>
For
XML files, you use XPath to specify the path to the values. In the previous XML file, the
Base Path parameter is the XPath expression //company/employee
and parameters Value Path and Label Path are
blank.The following example shows the equivalent file in
JSON:
{
company: {
employee: [
"Alice",
"Bob",
"Chris"
]
}
}
In the previous JSON file, the Base Path parameter is
company.employee
and parameters Value Path and Label
Path are blank.You can include separate label and value information in the file.
For example, the following XML file includes names and ID
numbers.
<company>
<employee>
<name>Alice</name>
<id>1</id>
</employee>
<employee>
<name>Bob</name>
<id>2</id>
</employee>
<employee>
<name>Chris</name>
<id>3</id>
</employee>
</company>
In
this case, the Base Path parameter is the XPath expression
//company/employee
. The Value Path parameter is an XPath
expression that shows the path to the value relative to the base path; in this case the expression
is ./id
. Similarly, the Label Path parameter an XPath
expression that shows the path to the label relative to the base path; in this case the expression
is ./name
.The following JSON file is equivalent to the previous XML
file:
{
company: {
employees: [
{ name: "Alice", employee.id: 1 },
{ name: "Bob", employee.id: 2 },
{ name: "Chris", employee.id: 3}
]
}
}
In
this case, the Base Path parameter is company.employees
. The
Value Path parameter is employee\.id
and the Label
Path parameter is name
. Note: When specify the path for a JSON file,
escape periods in attribute names with backslashes, as in the Value Path
parameter in the previous example.
When you use attributes in an XML file, use the
@
character to specify an attribute in XPath. For example, the following XML file
has values in
attributes:<company>
<employee id="1">Alice</employee>
<employee id="2">Bob</employee>
<employee id="3">Chris</employee>
<company>
In
this case, the Base Path parameter is the XPath expression
//company/employee
. The Value Path parameter is
./@id
and the Label Path parameter is a period
(.
).