1. Technology

XML Formatting – How to Put XML Data on a Web Page

Lessons in XML – Syllabus – Lesson 5


Knowing the basics of XML is perfect except for one thing: it does not mean much without formatting. When you upload an XML file to the Internet and view it, you see the code and a message stating there is no formatting data linked to the document. XML is a container. It transports data. By design, XML is meant to centralize your information in one location for efficient updates. Formatting this file is a crucial step to working in with XML. Without the formatting, XML is just a fancy text file.

There is a number of ways you can format XML files. The choice you make will depend on many factors, how the system is utilized, for example. Let‚s take a look three formatting styles available.

Things You Need:

A basic text editor like Notepad (Windows) or TextEdit (Macintosh).

What is a DTD

Document type definition (DTD) is the first formatting file for XML. At the inception of the language, DTDs were the way to go. Nowadays, this method of defining the rules for XML is a little archaic. Creating DTD files involve fairly complicated coding. You can work with XML and never write a DTD file or inline code. It is still pertinent to know what the term means and how it might function.

What is a Schema (XSD)

Schema came about to replace the DTD. They are written with XML syntax to be less complex. Essentially, a schema does the same thing as the DTD document. It validates the XML data to ensure it is well-formed and viable. Technology always strives to build a better mouse trap. This is true for XML formatting, as well. As XML grew, it became necessary to do more than just validate the code. This necessity made schema somewhat archaic too. Writing a valid schema is a beneficial skill to have, however, because schema defines some essential terms in XML.

What is XSL

Of all the available formatting techniques, extensible stylesheet language (XSL) is the one you will probably work with the most. XSL is a family of languages to transform and render XML documents. XSL translates the code into something that will display on the Internet. Through XSL, you build a platform for the data contained in the XML file and make it mean something.

HOMEWORK DAY 5: Define the first three formatting styles for XML and understand the difference. Practice writing XML code. Write a list of your five favorite books, complete with author, publisher and a brief description. Translate this list into a valid XML file for a catalog and save it to your hard drive.

If you would like help with the homework, or want to discuss the class, you can do so in the HTML / XML Forum.

Review Lesson 4

©2014 About.com. All rights reserved.