Latest News

the latest news from our team

Processing XML Data that is Outside of XML Tags

Some software creates XML that has variable names in text outside of the XML tags. These variable names are not XML attributes or elements. For example:

<FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName=" @Shipped_To}">
<FormattedValue>DR EMMETT BROWN 1640 RIVERSIDE DRIVE HILL VALLEY CA 95022</FormattedValue>


Here is how this XML looks in the eFORMz Viewer:

To set an eFORMz variable named ShipToAddress to the name and address within the XML tag Value, add ObjectName and Value to eFORMz as XML variables, and then set ShipToAddress to the contents of Value when ObjectName contains the string “ShippedTo1”. The details are in the following steps:

  1. Start the eFORMz Composer, open your project and load the XML file as data.
  2. Look at your XML and identify the XML variable name and its corresponding value. In this example, we want a variable to be set with the Ship To address. The XML variable name is ShippedTo1, and its value is in the Value field, which you can see in the image above.
  3. Create a variable in the Composer with the name you want to use for the variable. To create the variable, right click the form > Add variable > By position. The variable here is named ShipToAddress. Click OK.
  4. In the Composer, right click the line that contains the XML variable name (in this example, ObjectName) > Add Variable > OK.
  5. Right click the line that contains the value that you want the variable to be set to. This example sets a variable to the Ship To address, so right click Value > Add Variable > OK.
  6. Right click the form > Add Pre-condition Procedure > Load Variable from a Variable. Use this procedure to assign values for all the XML variables. Type a name for the procedure, and select N/A for the variable. Click OK.
  7. The Load from Variable window opens. This is where you match the variable with its value. In Source Variable, select the variable you added in Step 5. Its name is Value.
  8. Click Choose values using match.
  9. Next to When variable, select the variable from Step 4. Its name is ObjectName.
  10. In the matches area, click Constant. Type the XML variable for ObjectName. This example shows a name ShippedTo1.
  11. In the Variable field, select the eFORMz variable that the value is assigned to. The eFORMz variable ShipToAddress is assigned the value of the Value variable when the ObjectName variable equals the string ShippedTo1. The result is an array of values from the XML file in the eFORMz variable ShipToAddress.
  12. Save the changes to your project.

Leave a Reply

Your email address will not be published. Required fields are marked *