XML Tutorial Tools and Techniques

Author: Jaidev

XML Editors

In order to author XML documents an editor is required. The most basic editor is of course Notepad! But if one were to consider productivity, it will soon become evident that a plain text editor is not going to suffice.

Main Features of Modern XML Editors

In Lesson 3, we had seen some basic requirements of XML Editors. Let us expand on those now. The fundamental characteristics of XML Editors are that they allow the following features.

XML Editors comparison

Examples of Editors

An extensive listing of popular XML editors can be found at these sites:

http://www.xml.com/pub/pt/3

http://www.xmlsoftware.com/editors.html

My personal favorites are:

Commercial

* XMLSPY from Altova (http://www.altova.com): There is a home edition which is for free.

* TurboXML from TIBCO (http://www.tibco-ext.com): Part of the Extensibility Platform. There is a 30-day trial edition

Low Cost

* EditiX (http://www.editix.com/): Low Cost shareware editor with many useful features

* Peter’s XML Editor (http://www.iol.ie/~pxe/): Completely Free barebones editor

XML Parsers

In one needs to work programmatically with XML, one would need the basic programming tool to do so – the XML parser. An XML parser as we have seen in an earlier chapter converts an XML document into a structure that can be used by program code or into a set of events that can be responded to by program code.

There are quite a number of XML frameworks and parsers available today. Some of the more popular ones are listed below:

* Xerces (for Java and C++) from Apache available here http://xml.apache.org/xerces2-j/ http://xml.apache.org/xerces-c/

* JAXP from Sun available here http://java.sun.com/xml/jaxp/index.jsp

* C# Parsing Support using the XMLReader and  XMLDocument classes

* PHP Parsing Support available here (non-validating parser framework) http://www.php.net/manual/en/ref.xml.php

XML Transformation Frameworks and Tools




 Transformation refers to the capacity to transform XML documents from one form to another. These are typically done using what are known as XSL Transformations or XSLT. An example of a transformation (from XML to HTML) might be interesting here. Note that we are not showing the actual transforming (XSLT) file which we will discuss in more detail in a later lesson.

XML Input

Example of XML Input

XML Output

There are many ways of performing XML transformations and observing the output:

1) Editors and Toolboxes: Most commercial and shareware XML editors support transformation within the editing framework itself. A free editor with support for transformations is XMLCooktop available at: http://www.xmlcooktop.com/

In addition there is an interesting toolbox available at: http://ats.nist.gov/xsltoolbox/

2) Using Internet Browsers: The common browsers have XML transformation support built-in. For instance:

Internet Explorer 5+ Netscape Navigator 7

support the 1999 W3C XSLT recommendation. These constitute the easiest way to view the result of XML transformations.

3) Using Programming Methods and Frameworks:

Xalan (for Java and C++) from Apache available here http://xml.apache.org/xalan-j/ http://xml.apache.org/xalan-c/

C# XSL support: Using the fundamental “XslTransform” class

PHP XSL support: Using the “xslt_process” function

Many other languages support XML transformations using either native language libraries or third party libraries.

XML Databases and Information Storage Options

Before we get to the core topic here, let us take a quick look at what kind of information storage is necessary for an application. I would like to propose the following decision matrix. The rules below certainly do not constitute a “gold standard”, but they do give a fairly good idea of the options.

XML data Storage Characteristics and methods

While designing an application, it is important to decide how one wants to store the information content – as data or as documents. If one decides to store the information as data, then should the information go into a general RDBMS or into a native XML database? The above table aims at giving general guidance to help make these decisions.

An exhaustive list of native-XML and XML-Enabled Databases (those that store data as XML natively) is available here: http://www.rpbourret.com/xml/XMLDatabaseProds.htm#native

Equipped with Tools

With that whirlwind introduction to common tools to work with XML we are now prepared to take a first strike at the core of XML – the Document Type Definition and Schemas. I would suggest you download at least one XML editor such as XMLSpy Home Edition (recommended) or Peter’s XML Editor (barebones but will suffice) now. With that and the faithful browser (IE6+ or NN7+) we will have all the support we require to go through most of the examples to follow. Camp 1 established… See you on the journey to Camp 2!!

Copyright© 2004-2006 Aleksey Nudelman