| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45
Back To Interview list
In this CFUN-04 interview, Michael Smith interviews Jeff Tapper about his "CFMX XML" talk at CFUN-04. Jeff has been coding ColdFusion since 1995, and has co-authored several books on Internet application development.
Michael Smith: Why should developers be interested in XML, Jeff?
Jeff Tapper: The eXtensible Markup Language (XML) is incredibly powerful because of its flexibility. While many think of XML as a revolutionary way for businesses to exchange data, that is but one of the very important roles that XML fills today. XML-based documents are often being used to share common data between different technologies, such as allowing a single configuration file to work for both a ColdFusion back end and a Flash front end of an application.
MS: What are other uses for XML?
JT: Others are using XML to create Microsoft Office Documents (such as Word, Excel, etc.), and the Apache XML Project has introduced ways to create other types of documents, such as Adobe Acrobat PDF's. One of the latest innovations to use XML is Macromedia's new Flex product, which allows developers to write tag-based XML documents to create Rich Internet Applications without the need to learn the Flash interface.
MS: What about Web Services?
JT: Of course Web Services became possible through the use of XML, which is used as the language of the SOAP envelope of each transaction. XML is also used in the WSDL files, which act as the interface to the web service.
In short, XML has revolutionized the computer industry, and continues to do so.
MS: So what does typical XML look like?
JT: XML documents come in different sizes and shapes, but their one unifying characteristic is their tag-based nature. Here is a simple XML file describing some books I've worked on:
<title>Object Oriented Programming with ActionScript 2</title>
<author primary="true">Tapper, Jeff</author>
<title>Dynamic Publishing with ColdFusion MX</title>
<author primary="true">Elmore, Ben</author>
MS: That can get pretty complex! I have heard that parsing through XML is a real headache. Does CFMX help in this?
JT: Working with XML documents prior to CFMX was indeed a true nightmare. With the release of CFMX, XML is now a native object in ColdFusion, making it much simpler to manage. In fact, an XML Object can be referenced with syntax similar to that used for structures and arrays in ColdFusion. For example, if the above XML document was read into a variable named xBooks, the syntax to output the title of the first book would be: #xBooks.books.book.title#. There are also a whole suite of new functions available to ease the process of working with XML, such as the XMLSearch() function (which allows for a query of an XML object).
MS: That is amazing! It sounds like you can treat the XML a bit like an unusual database...
JT: In many ways, XML documents can be treated like a type of database. The real power of XML, though, is the ability to share complex data across disparate systems. The same XML file can be read and parsed into native data elements in dozens of different languages, such as ActionScript, Java, ASP, C#, Perl, PHP, and, of course, ColdFusion. This has greatly simplified the process of sharing data across these systems, and is far more powerful than earlier attempts at cross-platform standards, such as EDI.
MS: I have heard that Fusebox 4 uses the XML parsing in CFMX to compile the Fusebox configuration commands to different languages. And Mach-II is similar.
JT: Absolutely, Both FuseBox 4 and Mach-II make extensive use of the XML as a native CFML object. I dare say, that neither of these two frameworks would be possible without the extensive XML handling abilities native to CFMX.
MS: Are there any internal XML functions in CFMX that we can use?
JT: As mentioned above, CFMX now has many new XML functions and tags. Aside from XMLsearch (described earlier), there are several for creating XML objects. XMLTransform allows us to transform an XML document into many other formats, such as Microsoft Office (.doc, .xls), Adobe Acrobat (.pdf), HTML, CSV, etc.
MS: I think that after your session I will have a lot of neat tools for using XML under my belt! Thanks for talking with me.