As an XSQL developer, you will be creating your own implicit schemas along the way. However, it is a bit grandiose to think of these as brand new markup languages. In most cases, they are going to be the Oracle canonical representation plus some XML that you add around the edges. Still, this does give you an XML layer to your applica- tion that is separate from the actual presentation. In terms of XSQL development, this is the key advantage of XML. You are able to separate your application data from the actual presentation. XSLT yields the actual presentation while you are able to easily repurpose the XML layer. Well-Formed versus Valid Documents You may have heard of a document being referred to as valid or well formed. The def- inition and distinction is important to the discussion here. A well-formed document is simply an XML document that is syntactically correct. A valid document is a well- formed document that also follows the rules of a schema. Anytime you write XML, it has to be well formed. The need for validity is deter- mined by whether there is a schema associated with your document. On the one hand, if an application is processing the document, it is required to be valid. This makes the job of the application much easier. If the document is unacceptable, the parser will gen- erate an error before the document gets to the application. This greatly reduces the number of error cases that the application must be prepared to handle. Because XSQL documents are fed to an applicationthe XSQL page processorthey must be valid. They must agree with the schema for XSQL pages. On the other hand, the XML documents that XSQL generates only need to be valid. This does not mean that it is all free love and long hair. First, you may have a Web ser- vice consuming your XML that expects a schema. In most cases, your document is going to be transformed. If your generated XML doesnt come out right, your transfor- mation will be ugly. Fortunately, the XML that XSQL generates is pretty tight. Bad transformations are really only a problem if you get fancy with custom action handlers or include foreign XML. Document Structure An XML document is structured like a tree. Trees are some of the most pervasive struc- tures in all of computer science. Probably the most common usage is a file system. Trees are a great elegant structure because they can be used to establish relationships between any set of data. Even a table of data can be easily represented with a tree, as youll see later in this chapter. Trees can be generally described with the following rules: nn There can be only one root element. nn The root element is the only element that has no parent. nn Every nonroot element has exactly one parent element. nn Any element can have one or more children elements, or no children at all. In XML, the parent-child relationships are represented by start and end tags. The following example shows a simple document that contains two child elements. Introducing Oracle XSQL 15 271209 Ch01.F 12/9/02 2:00 PM Page 15