Introduction to XML Generation


One of the fundamental skills you will use when working with XML is generating an XML document. Before any XML processor can operate on an XML document, someone, somewhere (and it might be you) will need to create the XML document. Two methods of generating XML documents exist: static generation and dynamic generation. Each will be discussed in the following paragraphs.

The static approach to generating an XML document typically refers to the manual process of writing the XML document in an editor. This file is initially created and remains the same until someone or something modifies it. Small and simple XML documents can be easily written using just a plain text editor, as long as you are familiar with the XML syntax. For the larger more complex files, this approach is very cumbersome and error prone. For these reasons alone, you should utilize an XML generation tool. Several currently available commercial and open source tools enable you to create XML documents using a What You See Is What You Get (WYSIWYG) interface. These tools are helpful because they point out errors immediately in your XML files (for example, missing end tags, missing required elements, and so forth). One commercial tool used during the development of this book is XML Spy (http://www.xmlspy.com). XML Spy is a suite of tools that have been designed to support all aspects of XML work (for example, editing, DTD development, XML schema development, and XSLT stylesheets).

The dynamic approach to generating XML documents is commonly used. Dynamically generated XML documents are created by an application. This technique is usually employed when a program generates an XML file based on a data source (for example, user -supplied input on a web page, CSV input file, results of a database query, and so forth). Or, an application can be used to convert the contents of a text file to XML.

The XML standard defines many rules that must be followed whenever you create XML documents. Both static and dynamically generated XML documents must follow these rules. To simplify the production of XML documents, several Perl modules have been developed to support this task. Let's take a look at the different methods of generating XML documents.



XML and Perl
XML and Perl
ISBN: 0735712891
EAN: 2147483647
Year: 2002
Pages: 145

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net