Syntax and Semantics


As mentioned earlier, XML was heralded as a semantic alternative to HTML. Let's take a closer look at this claim. Before we do, we need to say a few words about "parsers" and "well formedness."

Parsers

For software to make use of an XML document or message, first it must parse it, or separate it into its tokens. Many parsers are available, and many products now contain them. This process of taking an XML document and separating it into its component pieces is also called "shredding," especially if the intent is to store the pieces atomically in a relational database.

A parser looks for the matching tags and turns everything it finds in between into a token (which may or may not be further subdivided if it has matching tags within it).

Well Formedness

The parser can evaluate whether the XML message (or document) is "well formed." Basically, well formed means that the tags match up and there are no characters out of place. Well formedness says nothing about what the data means or whether it agrees with its schema, or even if there is a schema. We'll discuss XML schemas later in this chapter, but at this point we should note that XML does not require schemas. An XML document can be well formed whether it has a schema or not.

Semantics in the Tags?

We have yet to ask the question, "What do the tags mean?" In other words, where do the semantics come from? Looking back to Figure 11.2, there is nothing inherent in the tag or anything else that creates meaning for the tag "author," other than the fact that many of us humans recognize it and think we know what it means. As far as an XML parser is concerned, it could just as well have been as shown in Figure 11.10.

start figure

         ?xyz> John Smith ?/xyz> 

end figure

Figure 11.10: A tagged value.

The XML web is still really a syntactic web.[77] We have agreed on the syntax, the matching of the tags, and so on, but little else. Even where we have schema, which we do most of the time, the systems are not aware of the semantics; only the humans who agreed on the schema are aware of the semantics.

Let's address this now by looking at schemas and namespaces.

[77]Jonathan Robies, "The Syntactic Web." Available at http://www.idealliance.org/papers/xml2001/papers/pdf/03-01-04.pdf.




Semantics in Business Systems(c) The Savvy Manager's Guide
Semantics in Business Systems: The Savvy Managers Guide (The Savvy Managers Guides)
ISBN: 1558609172
EAN: 2147483647
Year: 2005
Pages: 184
Authors: Dave McComb

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net