The ABCs of XML: Part I

This three-part series for CONTROL introduces readers to the basic rules of XML, its terminology and related standards, and discusses what you’ll need to know to survive in the world of connected data.

Share Print Related RSS
Page 2 of 2 1 | 2 Next » View on one page

- <Header>
  <Abstract />
  <ApprovedBy />  
<AreaModel>\\BatchServer\BATCHCTL\AreaModel\RECIPES\AMCASCON.CFG
   </AreaModel><AreaModelDate>2006-02-27T09:40:33</AreaModelDate>
  <Author>JTSever</Author>
  </Header>
- <Steps>
- <Step XPos=”600” YPos=”1100” AcquireUnit=”true”>
  <Name>DRAIN:1</Name>  
<StepRecipeID>DRAIN</StepRecipeID>  
<UnitAlias>UNIT500</UnitAlias>
  </Step>
- <Step XPos=”600” YPos=”600” AcquireUnit=”true”>
  <Name>FEED:1</Name>  
<StepRecipeID>FEED</StepRecipeID>  
<UnitAlias>UNIT500</UnitAlias>
  </Step>
  </Steps>
  </RecipeElement>

FIGURE 1: XML READER
XML Reader
This tool takes the raw XML and translates it into an easy-to-read table.

Introduction to XSLT
I recently overheard the following conversation between two automation engineers: 

"They want to review the recipes."
"How do they want them?"
"Can you print them out?"
"That'll take a few days."
"Can you export them?"
"I can save them as XML."
"What do I do with that?"
"I don't know."

I'm not sure how this problem was resolved because I couldn't stick around to help them out. Had either of them known about XSLT, they could have transformed those XML recipes into any number of formats. The easiest of these would have been a CSV that could be opened in Excel. Another option (my favorite) would be to transform the recipes into MS Visio drawings. Either of these two tasks could have been accomplished in a few short hours and it would have worked on all 1,500 recipes.

XSLT is a standard for converting XML to something else. The something else is growing rapidly.  Most frequently, the something else is XML in a different data structure. This article opened with a problem whose solution was to convert one XML file (with bad code) to another XML file (with good code). Other common formats created by XSLT include HTML and plain text. One of the most popular formats our company creates with XSLT is MS Word documents. Microsoft supports XML as a format for most or all of its Office 2003 applications. 

In this series, I also will introduce XSLT as a declarative language. I will describe the transformation process and explain some of the basic XSLT programming elements. The article will also discuss XSLT expressions, match patterns, recursion, templates, default templates, XSLT processors, scripting, and some of the limitations of XSLT. Finally, I'll point you to a number of resources and applications to help you learn more about XSLT and to get up the XSLT learning curve.

Putting It All Together
Learning a new language is not a trivial undertaking. There needs to be a big pay-off if you're going to spend the time to learn new data structures and languages. Rarely has a new language made your life better. This one will.

The final article will provide real world examples of what can be accomplished with XML and XSLT. I'll make sure to point out obstacles that commonly arise and how to over come these. I'll provide XML samples from real automation systems and accomplish tasks that have practical use in the everyday life of an automation engineer.

I hope that once we've finished this series you'll be well armed and ready apply these concepts to your everyday tasks.


 

PART 2
PART 3
Online Resources
www.w3c.org
www.xml.com
www.xml.org
www.topxml.com
msdn.microsoft.com/xml


  About the Author

John T. Sever is president and founder of Cascade Controls Inc. Sever has more than 20 years of experience as a process and automation engineer and can be reached at 708/802-6000 or at johnsever@cascon.com.
 

Page 2 of 2 1 | 2 Next » View on one page
Share Print Reprints Permissions

What are your comments?

You cannot post comments until you have logged in. Login Here.

Comments

No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments