XML technologies / XML / Perl & XML / Introduction to XML

(Excerpt from "Perl & XML" by Erik T. Ray & Jason McIntosh)

XML is a revolutionary, yet also evolutionary, markup language. It combines the general power of SGML with the simplicity of freely definable markup and well-formedness rules. Its unambiguous structure and precise syntax make processing XML data with programs straightforward and pleasant.

XML lets you define a markup language tailored to your data. Instead of overloaded, presentation-oriented constructs such as those in HTML, you choose suitable element names yourself. Element and attribute declarations in a DTD even let you specify your format formally.

XML provides syntactic conveniences such as Entities as abbreviations, comments or CDATA sections to improve readability, and processing instructions to control third-party applications. Elements and attributes can be grouped through Namespaces to improve document organization. The attribute xml:space even lets you control whitespace handling, often a problem in markup languages because human readability and formal correctness can conflict.

Several useful technologies help manage and transform documents. A schema, the successor to the DTD, can validate an XML document against a canonical model. Schemas go considerably further than DTDs because they can also constrain text data, greatly improving the precision of formal specifications. XSLT is an extensive language for transforming XML documents into various output formats. There are often simpler ways to process XML, but not always.

This chapter provides a brief introduction to XML—or a refresher—covering its origins, structure, and use. Feel free to skip it if you already know XML or are eager to start programming. Just remember it is here: you may need it later.

  

  

  

 

 

 

back to top