Wiki source code of Formularwerte aus XML importieren
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{figure image="import_xml_en.png" clear="h1"}} | ||
2 | User interface for configuring the options of an action of type //Set form fields from XML//. | ||
3 | {{/figure}} | ||
4 | |||
5 | Actions of type //Set form fields form XML// can be used to fill form fields with data from an XML document. This makes use of [[XPaths>>url:http://www.w3schools.com/xml/]] to [[select>>url:https://www.tutorialspoint.com/xml/]] a value from the XML document. | ||
6 | |||
7 | == Parameter == | ||
8 | |||
9 | ; XML source | ||
10 | : A previous action providing the XML document to be used. | ||
11 | ; Select XSL template | ||
12 | : An optional XSL transform applied to the XML document. | ||
13 | ; Values to be set (Set XPath) | ||
14 | : In the table, specific values from the XML document can be set for form elements. | ||
15 | :; Field name | ||
16 | :: Name of the form element to be changed. | ||
17 | :; XPath | ||
18 | :: XPath for selecting a value of the XML document. The value of the form field will be set to this value. | ||
19 | |||
20 | == Example == | ||
21 | |||
22 | To illustrate how this action works, consider the following XML: | ||
23 | |||
24 | {{code language="XML"}} | ||
25 | <?xml version="1.0" encoding="UTF-8"?> | ||
26 | <xfc-data xfc-version="4.5.2" generation-date="2017-01-09 11:23:43.190 MEZ"> | ||
27 | <processes> | ||
28 | <process process-uid="f1e677ad-012d-4586-884b-ac2ee029cb00" creation-date="2017-01-09 11:23:43.0 MEZ" project-name="XML" status=""> | ||
29 | <form version="1"> | ||
30 | <field name="upl1"> | ||
31 | <plainValue><![CDATA[]]></plainValue> | ||
32 | <values count="0"/> | ||
33 | <label><![CDATA[]]></label> | ||
34 | </field> | ||
35 | <field name="tf1"> | ||
36 | <plainValue><![CDATA[foobar]]></plainValue> | ||
37 | <values count="1"> | ||
38 | <value index="0"><![CDATA[foobar]]></value> | ||
39 | </values> | ||
40 | <label><![CDATA[]]></label> | ||
41 | </field> | ||
42 | <field name="xf-action"> | ||
43 | <plainValue><![CDATA[btnPrev]]></plainValue> | ||
44 | <values count="1"> | ||
45 | <value index="0"><![CDATA[btnPrev]]></value> | ||
46 | </values> | ||
47 | <label><![CDATA[]]></label> | ||
48 | </field> | ||
49 | </form> | ||
50 | </process> | ||
51 | </processes> | ||
52 | </xfc-data> | ||
53 | {{/code}} | ||
54 | |||
55 | To select the value of the field named //tf1//, use this XPath: | ||
56 | |||
57 | {{code language="XPath"}} | ||
58 | //processes//field[@name="tf1"]/plainValue/text() | ||
59 | {{/code}} |