History of XML Schemas

In Chapter 2, “XML and Related Technologies,” you learned that XML is a subset of SGML. SGML uses something known as a Document Type Definition (DTD), for defining the structure of an SGML application language.

A DTD defines the semantics of an application language—that is, the names of elements and attributes and the markup's structure—and the hierarchy of those elements within the document. For instance, an HTML DTD dictates that the <HTML> element (or tag) must come first in an HTML document, followed by a <HEAD> tag, and then a <BODY> tag. You can also gather from the DTD that inside the <HEAD> element may be a <META> tag with certain attributes, such as a name attribute for defining certain properties of the document or an http-equiv attribute for gathering information for the HTTP response headers.

A DTD also references items called entities. An entity's primary purpose is to incorporate additional internal and external characters into the document with greater ease and efficiency. For instance, if you didn't want to type your company name over and over in your XML document, you could create an entity reference to it in your schema. Therefore, you might need to type in only the initials to your company name, but when the XML is parsed, the entire name will be printed. Entity references are delimited by the ampersand (&) and semicolon (;).

XML schemas take DTDs to another level. Like DTDs, they do a great job at defining the structure and semantics of XML documents, but they also allow for the added benefit of defining data types and namespaces. We will discuss each of these in addition to some other advantages that XML schemas have over DTDs and then discuss some other schema languages to give you an overall idea of their similarities and differences. HTML defines the static display of text, and XML defines the data itself.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset