Creating Documents  «Prev 

XML Meta Language

XML is a meta language that allows you to create and format your own document markups. With HTML, existing markup is static: <HEAD> and <BODY>, for example, are tightly integrated into the HTML standard and cannot be changed or extended. XML, on the other hand, allows you to create your own markup tags and configure each to your liking.
For example, <Heading>, <Sidebar>, <Quote>.
Each of these elements can be defined through your own 1) document type definitions and 2) stylesheets and applied to one or more XML documents. XML schemas provide another way to define elements

XML Stylesheet

Browsers use an XML stylesheet or transformation to display XML files. An XML stylesheet is a text-based file with an XML format that can transform one format into another. They are most commonly used to convert from a particular XML format to another or from XML to HTML, but they can also be used to process plain text. In this case the original XML is transformed into HTML, which permits the styling of elements to give the different colors as well as the ability to expand and contract sections using script.

Transformations

Transformations allow you to work with XSLT and convert XML documents to other formats such as HTML.
Before we move further, we need to standardize some terminology. An XML document consists of one or more elements. An element is marked with the following form:
<body>
This is text formatted according to the body tag.
</body>.

This element consists of two tags: an opening tag, which places the name of the element between a less-than sign (<) and a greater-than sign (>), and a closing tag, which is identical except for the forward slash (/) that appears before the element name. Like HTML, the text between the opening and closing tags is considered part of the element and is processed according to the rules of the elements.

Overview of Viewing XML Data

The basic idea of markup languages is the separation of the content of a document from its form (i.e., how it is presented to a user). Therefore, extra processing is needed before viewing marked-up information on a Web front end. For us, two mechanisms are of particular interest: formatting and transformation. From the latter perspective, XML may have to be transformed into another format, an HTML document, for instance. Transformation aspects will be covered later. The formatting of XML documents may be achieved by using style sheets. They may be regarded as collections of rules to transform abstract XML information into formatted information to be passed on toward an output device. The transformation is done by a style sheet processor that will read the XML input along with the style sheet given. From that the processor generates the output accordingly, as long as the style sheet follows a notation the processor understands. This process may be performed on the server as well as on the client side of an Internet-based information system.
The basic idea is illustrated in Figure 3.2 from the general perspective of SGML. The decision on whether to process an XML document on the server or to pass it to the client depends on the application. As long as we only wish to view XML-based information, we may perform the processing on the server. If an application requires XML data for decentralized processing on the client side, we have to send the XML document along with the style sheet. This may be the case in e-commerce applications, for example, when exchanging product information or ordering data.

Overview of creating final form documents in SGML
Figure 3.2 Overview of creating final form documents in SGML

XML, the lazy Developer's Nightmare

HTML rendering programs have been very forgiving with developers.
If you forget to close a tag, the closing tag is usually inferred.
If you use the wrong tag, the browser disregards it and renders the document, no matter how ill-constructed it is.
For that reason, HTML is great for the lazy developer. Half an effort can still produce attractive pages.
XML, on the other hand, is far stricter. Any single error will prevent your page from rendering. XML is not for those who dislike detail or want to construct pages haphazardly. XML requires attention and discipline.

The syntax rules of XML are simple, logical, and easy to learn.
Question: Are XML tags case sensitive?
Answer: Yes, XML tags are case sensitive.
Opening and closing tags must be written with the same case. In XML, all elements must be properly nested within each other. In the example above, "Properly nested" simply means that since the <i> element is opened inside the <b> element, it must be closed inside the <b> element.