This is chapter one from the book, XML and FrameMaker, by Kay Ethier (Apress, ISBN: 159059276X. 2004). Ethier reviews some of the basic XML terms and rules, and provides a basic overview of the purpose of DTDs and XSLT.
Introduction to XML - Terminology Continued (Page 3 of 7 )
A DTD describes a set of elements and attributes for a document type, and a schema does pretty much the same thing. A schema, unlike a DTD, is an XML document. The elements, attributes, and other information in schema are defined using XML syntax. As with a DTD, you may validate a document against a schema.
As of FrameMaker 7.1, schema are not supported for use with XML documents. If you have a schema, you may be able to convert it to a DTD for use with FrameMaker.
NOTE: Tools such as TurboXML allow you to open a schema and save it as a DTD. Some also allow you to take a DTD and save it as a schema, should you need to do so.
This refers to the way XML tags envelope other tags. A parent may contain-between its beginning and end tags-a child element's beginning and end tags. It may even contain multiple child elements, each beginning and ending in turn.
Similar to a family tree, elements in an XML file have relationships to each other. Referring to the example in Figure 1-1, you can see that the elements in the XML instance are nested, with some elements inside others. You can refer to Figure 1-1 as you review the hierarchical terms parent, child, sibling, descendant, and ancestor. The example may help you to better understand their meaning.
An element that contains another element is the parent of the second element. In Figure 1-1, you see the parent element <Recipe>, which contains elements such as <Name>, <Ingredients>, and <Procedure>.
An element contained inside another element is a child of the element that contains it. In the example in Figure 1-1, <Name>, <Ingredients>, and <Procedure> are children of <Recipe>.
Two elements that are contained inside the same parent are considered siblings. In Figure 1-1, <Name>, <Ingredients>, and <Procedure> are siblings.
Any elements which are hierarchically above an element in the Tree View are the ancestors of that element. <Recipe>, for example, is the ancestor of all elements (as such, it is the document root element, which is described further in the next section on XML rules). When viewed in tag mode, an ancestor would be the tags before and after an element.
Any elements that are hierarchically inside an element (wrapped inside its beginning and end tags) are the descendants of that element. <Quantity> is one of many descendants of <Recipe>.
A style sheet is a document outside the XML that can be used to format it. You may be familiar with the cascading style sheets (CSS) used with HTML. There are also XSL style sheets, XSLT (a subset of XSL) style sheets, and more.
The document type (DOCTYPE) is sometimes included in XML documents and refers to the specific DTD to be used for that document. For example, underneath your XML declaration ( Line 1) you might have a DOCTYPE naming your DTD by filename ( Line 2).
<!DOCTYPE UserManual SYSTEM "manual.dtd">
The process of validation checks your document's structure against the rules defined in the DTD (outside FrameMaker) or EDD (inside FrameMaker). In FrameMaker, there is a Validate tool which moves you from error to error-if you have any errors-within your structured document or structured book.
If any content inside FrameMaker is not following the structure rules, red symbols or red dashed lines will appear to help you see the errors. It then tells you when your documents are valid. In other words, it tells you whether or not the documents follow all the rules of the DTD.
If you do not correct the errors, you cannot produce valid XML but you can still produce well-formed XML. Well-formed means that your documents follow all the rules of XML but do not necessarily confirm to a DTD or schema. Depending on what you are doing with your XML, you may be able to work with well-formed XML. If you plan to reuse, store, and share content, however, you may need to aim toward valid XML.
This chapter is from XML and Framemaker, by Kay Ethier (Apress, 2004, ISBN: 159059276X). Check it out at your favorite bookstore today.