Differences

This shows you the differences between two versions of the page.

Link to this comparison view

action type - read xml file [2016/09/14 18:19]
action type - read xml file [2016/09/14 18:19] (current)
Line 1: Line 1:
 +~~NOTOC~~
 +====== 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|table]],​ or making changes to [[Field|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 Trigger|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 [[http://​www.w3schools.com/​dtd/​default.asp|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.
 +
 +{{ ::​read_xml_details.png?​nolink |}}
 +
 +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 : 
 +
 +{{ ::​read_xml_expression.png?​nolink |}}
 +
 +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 [[Field Type - File Attachment|File Attachment Field]], or define it through an [[Expression Builder|Expression]].
 +
 +==== Describe this action ====
 +Useful as a comment, this description will overwrite the automatically generated description in the [[Action Manager|Action Manager]].
 +
 +==== Queue this action and children ====
 +When an action is [[Action Queue|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 [[http://​www.w3schools.com/​xml/​xml_validator.asp|XML Validator]] can be found at W3Schools. ​ The validity of a DTD can be checked on [[http://​www.validome.org/​grammar/​|Validome]].
action type - read xml file.txt ยท Last modified: 2016/09/14 18:19 (external edit)
Copyright WorkXpress, 2024