xml – its role and use ben forta senior product evangelist, macromedia
TRANSCRIPT
![Page 1: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/1.jpg)
XML – Its Role and Use
Ben FortaSenior Product Evangelist, Macromedia
![Page 2: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/2.jpg)
Agenda
The Problem
Introducing XML
Working with XML
ColdFusion MX and XML
Web Services
![Page 3: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/3.jpg)
The Problem
![Page 4: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/4.jpg)
An Example
Organization A works with a supplier (organization B)
Organization A does not have access to organization B's IT systems
![Page 5: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/5.jpg)
The Problem
All interaction between the two organizations is manual Order submission
Status checking
Payment
Reporting
![Page 6: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/6.jpg)
The Need
The two organizations need to share information, despite differing environments and incompatible applications
![Page 7: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/7.jpg)
Introducing XML
![Page 8: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/8.jpg)
What XML Is Not
XML is not a way to format page layout (as is HTML)
XML is not a presentation language
![Page 9: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/9.jpg)
What Is XML
XML is less a “language” per se, and more a way to describe data
XML data is described using “vocabularies”
![Page 10: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/10.jpg)
Understanding XML
XML serves two primary purposes: Provides a framework to separate data
from presentation and layout
Provides a syntax that allows applications to share data
XML defines common information formats across nearly every major computing endeavor
![Page 11: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/11.jpg)
Example - The Challenge
An organization relies on multiple suppliers, each of whom uses a different computer system and thus a different way to describe parts
The challenge is to retrieve real time status information from multiple sources so as to be able to present it in a consistent format
![Page 12: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/12.jpg)
Example - The Solution
An XML format (a “vocabulary”) is agreed upon ahead of time, by the suppliers
Each supplier publishes data in the agreed upon format
The client retrieves the standardized data as needed
![Page 13: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/13.jpg)
Example - Sample Data
Sample XML vocabulary
<ORDER_STATUS> <SUPPLIER_ID>123</SUPPLIER> <ORDER_NUM>A24680</ORDER_NUM> <STATUS>Shipped</STATUS> <SHIP_DATE>20020101</SHIP_DATE> <SHIP_VIA>UPS</SHIP_DATE> ...</ORDER_STATUS>
![Page 14: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/14.jpg)
Working With XML
![Page 15: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/15.jpg)
XML Terminology
DTD – data definition document describing the XML data (sometimes called a schema)
DOM – document object model, a hierarchical view of XML content
Node – an item in the DOM, nodes are made up of a type, a name, and a value
Root – top level element in a document
Element – the actual content
![Page 16: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/16.jpg)
Displaying XML Data
XML is NOT a page layout language
XML describes data
XML data can be displayed in any client technology, including HTML, Flash, Java, JavaScript, ActiveX
![Page 17: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/17.jpg)
Working with XML
Working with XML requires tools that can manipulate structured XML data Read values
Walk trees
Search for and extract specific elements
Set values and build trees
![Page 18: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/18.jpg)
Applying Transformations
XSL is a template language that is used to provide display rules for XML data
XML is data, XSL is a set if display rules
XSL is applied to XML generating a transformation (the actual output)
![Page 19: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/19.jpg)
ColdFusion MX and XML
![Page 20: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/20.jpg)
ColdFusion MX and XML
ColdFusion provides build in support for: Reading XML data
Writing XML content
Applying XSL transformation
Performing XPath searches
![Page 21: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/21.jpg)
XML In ColdFusion
Within ColdFusion, XML documents are accessed as objects
An XML object in ColdFusion is a structure, and can be access as such
Objects are created using: <CFXML> XMLNew() XMLParse()
![Page 22: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/22.jpg)
Reading XML Data
XMLParse() converts an xml document into an XML object
<CFFILE ACTION="read" FILE="#xmlfile#" VARIABLE="xmldata"> <CFSET xmlobj=XMLParse(xmldata)><CFOUTPUT> #root.order_status.status#</CFOUTPUT>
![Page 23: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/23.jpg)
Writing XML Content
<CFXML> or XMLNew() creates XML objects that may be populated as needed
<!--- Create XML object ---><CFXML VARIABLE="Orders"> <Orders> <!--- Loop through orders ---> <CFOUTPUT QUERY="orders"> <!--- Write order ---> <order> <ordnum>#ordnum#</ordnum> <status>#status#</status> </order> </CFOUTPUT> </Orders></CFXML>
![Page 24: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/24.jpg)
Applying XSL Transformations
XSL transformation are applied using XMLTransform()
<CFOUTPUT>#XMLTransform(xmlfeed, xsldoc)#</CFOUTPUT>
![Page 25: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/25.jpg)
Performing XPath Searches
XPath is a search language used to find and extract values from an XML document
XPath uses search patterns to specify search criteria
<CFSET result=XMLSearch(xmlfeed, pattern)>
![Page 26: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/26.jpg)
Web Services
![Page 27: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/27.jpg)
Why Web Services?
XML is data and facilitates data sharing
Web Services are distributed applications built on top of XML (and SOAP)
Where XML formats data for sharing, SOAP facilitates that sharing
![Page 28: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/28.jpg)
Access to Web Services
<CFINVOKE> provides access to any Web Services
<CFINVOKE WEBSERVICE="http://www.xmethods.net/sd/2001/BabelFishService.wsdl"METHOD="BabelFish"TRANSLATIONMODE="en_fr"SOURCEDATA="Hello, my name is Ben"RETURNVARIABLE="name_french">
<CFOUTPUT>#name_french#</CFOUTPUT>
![Page 29: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/29.jpg)
Publishing Web Services
Any ColdFusion components can be made accessible as a Web service by simply defining the ACCESS in the component method
ACCESS="remote"
ColdFusion Components and methods may be secured using: User roles
Access levels
![Page 30: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/30.jpg)
Summary
XML is data sharing
ColdFusion MX makes XML usable
Web Services facilitate distributed XML data sharing
![Page 31: XML – Its Role and Use Ben Forta Senior Product Evangelist, Macromedia](https://reader036.vdocument.in/reader036/viewer/2022070411/56649f2f5503460f94c49df3/html5/thumbnails/31.jpg)
Q&A