TechMuse Technical Services

XML Background




Extensible Markup Language (XML)

XML is an emerging technology that is working its way into the mainstream of Web development. It is thus a technology that we needed to learn more about, so we prepared some projects that range from the basic to the more advanced. These demonstrate our commitment to keeping current with the technology.

As a framework for these projects, we have summarized some of the highlights of XML, first comparing XML with HTML to show how they complement each other, then offering some reasons for using XML, and finally listing various ways to get started learning XML.

XML vs. HTML

  • Typically XML tells us about data and HTML tells us about formatting data; i.e., you use XML to structure data, not to format it; you use HTML to format data, not to structure it. To illustrate this, let's look at a tagging example in which we use the name John Quincy Adams .
    HTML limits how you can describe this name:
    <html>
    <head><title>Name</head>
    <body>
    <p>John Quincy Adams</p>
    </body>
    </html>
    By contrast, XML gives you as much information about <name> as you wish to include:
    <name>
    <first>John</first>
    <middle>Quincy</middle>
    <last>Adams</last>
    </name>
    You might also give the element <name> an attribute with an ID number:
    <name id="12345">
    ... or a social security number:
    <name social="253-39-9338">
    ... or an origin:
    <name origin="english">
    The possibilities of describing <name> are almost endless.
  • As the above example demonstrates, XML provides a format in which you can structure data. You can also include a description of what the structured data does. For example, in describing the basic structure of a document — such as the title, headings, subheadings, body, and graphics — you need to define each element in terms of how it will be used in the document. You might, for example, use interchangeable French, German, and Japanese titles for your document, which you can retrieve online via the title's attribute identifier. You might also provide each subhead with an indexed number that allows you to group the data into chunks that can be saved in a database for reuse in an eLearning project; and so on.
  • XML allows you to mark up data any way you want. This means you can create your own XML tags to describe what you're working with. Tags, by the way, are typically used with elements, which include both the tags and the data being described . In our example above, John is encapsulated between the start and end-tags, <first> and </first>. The whole expression is an element:
  • Element: <first>John</first>.
    You separate the tags and the data they encapsulate from the formatting because the tags tell you what the data means - not how it looks.
  • XML is called extensible because it is flexible — not a fixed format like HTML. HTML is a single, predefined markup language that does not allow you to specify your own tags or attributes to semantically qualify your data.
  • XML is a meta language—a language used to describe other languages—that lets you customize your markup language to produce a limitless range of documents.
  • XML uses syntax rules to present information in tree-like structures, creating parent-to-child and sibling-to-sibling relationships. HTML does not support this type of structure.
  • XML elements are containers and must have closing tags. For example, <name> must have a closing tag, </name>). You could not have <p> without </p>, as you can with HTML.
  • Although XML will not replace HTML as a formatting language, XML will replace HTML as a source language for many types of applications.

top

Why XML?

  • One of the reasons for its fast becoming the mainstream technology for web applications is that XML offers you code reuse and automation where these assets are required.
  • XML is extensible, which means that you can go beyond the limits of HTML — such as accessing data stored in databases. Thus, you can offer dynamic content.
  • Instead of having to design different systems for each database you're working with, you can put an XML-designed database into a format that is readable by any computer equipped with the right browser.
  • When your data needs to be shared with a vendor, for example, you can apply your element names to a standard format, or schema, that everyone can understand and can agree to.
  • Netscape Navigator and Internet Explorer are on the verge of connecting JavaScript and XML using the W3C Document Object Model (DOM).
  • XML is a rapidly growing Web tool that promises powerful real-world applications.

top

Getting Started?

  • You need a browser that will display XML. Not all browsers do. Internet Explorer 5+ or Mozilla display XML . Browsers, such as the Netscape Navigator 4.x series and Opera 7 cannot display XML.
  • Learn the rules associated with Extensible Style sheet Language Transformations (XSLT), which include XSLT style sheets. You also need to learn the basic XML Path Language (XPath) commands that select the data for transfer to your output file. Finally, you need to understand Cascading Style Sheets (CSS) to format your data.
  • XML requires a parser, or XSLT engine that reads XML syntax to display your data. There are currently several free versions in the marketplace, including: Microsoft's MSXML, Saxon's open source Java version, and Xalan, an open source version written in C++ and Java distributed by Apache. The latest versions of these XSLT engines are available for downloading at:
Microsoft MSXML:
http://msdn.microsoft.com/downloads
/webtechnology/xml/msxml.asp.
Saxon:
http://saxon.sourceforge.net.
Xalan:
http://xml.apache.org/xalan-c/index.html

top