0

Can we give more then one xml input to jet(java emitter template)? If we can, then please give me an example.

escist
  • 763
  • 4
  • 13
  • 35
yogi
  • 21
  • 3

1 Answers1

0

You can't do it directly, but there are several techniques you can use to specify multiple XML's as input.

You can name one XML file inside the other or create a third XML file that simply names the two inputs (or however many you have). Say you have an XML file named in the input XML to JET:

<inputs>
   <input name="...full file name here..." />
<inputs>

You can load this file in for use in JET like this:

<c:load url="{/inputs/input/@name}" var="root"/>

The load tag reads a file (defaults to XML, but other types can be input.) and makes its contents available via the variable name you specify ("root" in this case). Normally the url attribute expects a String value that is the file name, but since we're using an attribute out of the model we use the curly brackets and xpath notation to indicate the attribute value to use as the file name.

Once you've loaded the file in you can access its contents. For example, if the root element in that XML file was and it had an attribute named company, then you attribute could access that attribute value with the c:get

<c:get select="$root/policies/@company" />

You can load as many files as you want. Just use a different variable name to refer to the root of each parsed file.

You could get a bit more complex and store your multiple files in the same directory using a naming convention. Then you could just specify the one directory path and derive the file names for all of your inputs.

Chris Gerken
  • 16,221
  • 6
  • 44
  • 59