Read XML File

Using a DTD, read an XML File and process it's data.

Available in Platform Version: 13.09.823

Explanation

Often times when integrating your WorkXpress application with applications from other vendors, they are going to want to communicate using XML. They will send the system a document of XML, in an agreed upon format, that contains data, and the system will need to assimilate and read that data, making records in a table, or making changes to fields on records.

Armed with a DTD, you can teach WorkXpress about the data it can expect in an XML file, and it can help you by creating automation triggers that execute on each level of data that's provided.

Example XML :

<?xml version=“1.0”?> <notes> <note> <to email=“kstennett@workxpress.com”>Kristian</to> <from email=“dmclain@workxpress.com”>Drew</from> <message> <subject>You are clear to rollout</subject> <body>Kristian : You are clear to start the rollout we spoke about earlier. Thanks, Drew</body> </message> </note> <note> <from email=“kstennett@workxpress.com”>Kristian</from> <to email=“dmclain@workxpress.com”>Drew</to> <message> <subject>Re: You are clear to rollout</subject> <body>Understood, rolling out.</body> </message> </note> </notes>

This is an example of how an external system might send it's Notes. Through a web service, FTP Download, or some other method, you are going to retrieve documents in this form, and you'll want to create Note records in WorkXpress that correspond. In order to do this, the provider will need to give you not only the means to access and download the XML, but also the DTD.

Example DTD :

<!ELEMENT note (to,from,message)> <!ELEMENT to (#PCDATA)> <!ATTLIST to email CDATA #REQUIRED > <!ELEMENT from (#PCDATA)> <!ATTLIST from email CDATA #REQUIRED > <!ELEMENT message (subject,body)> <!ELEMENT subject (#PCDATA)> <!ELEMENT body (#PCDATA)>

This file's purpose is to describe what the XML document's internals will look like. When setting up an XML Read Action, you must provide the DTD once, and then you can execute that action on many XML files that conform to the same specification as this DTD.

For more on DTD's and how they are setup, see the W3 School's chapter on DTD's.

After creating a Read XML Action, it will read the DTD and interpret what data it will be expecting. It will then show a list of the paths of XML that will be processed, and show each of these levels in the action tree below.

You can now drop actions in and around these levels of information, and the expression builder will know what pieces of data the XML file will provide. These pieces of information are available in the “Data from Actions” area, shown here :

The Actions Log will provide help information while the XML file is being processed, so for debugging needs be sure to check it!

Settings

Define the DTD

Upload the DTD for the XML Document you'd like to read.

XML Source

You can retrieve the XML from a File Attachment Field, or define it through an Expression.

Describe this action

Useful as a comment, this description will overwrite the automatically generated description in the Action Manager.

Queue this action and children

When an action is queued, the subsequent actions continue to process without it. Meanwhile, the queued action and its children process separately. Queue actions that you don't want a user to wait for.

Is my XML/DTD Valid?

It's very important that the XML fed into the XML Read Action is valid, well formed XML. There are many tools on the Internet for validating XML, and it is suggested that if you're having trouble with the Read XML Action that you verify the XML passed into the action is valid. One such XML Validator can be found at W3Schools. The validity of a DTD can be checked on Validome.

action type - read xml file.txt · Last modified: 2016/09/14 14:19 (external edit)
Copyright WorkXpress, 2018