XML
  Home arrow XML arrow Page 2 - Introduction to XML
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
XML

Introduction to XML
By: Kay Ethier
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 4
    2004-06-15

    Table of Contents:
  • Introduction to XML
  • A Review of Basic Terminology
  • Terminology Continued
  • Understanding XML Rules (1-3)
  • Understanding XML Rules (4-5)
  • Understanding XML Rules (6-7)
  • Looking at XML with Formatting

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Introduction to XML - A Review of Basic Terminology


    (Page 2 of 7 )

    Before getting into the rules of XML, it is important for you to be familiar with XML terms. Many are evocative of a family tree, alluding to the Tree View many tools use to display XML documents. It may help to refer to Figure 1 when reviewing these terms.

    Element

    When working within XML, you have beginning and end tags around your content-for example, <Recipe> and </Recipe>. These tags form an element, into which you may enter content or even other elements. In FrameMaker, elements can be displayed in a Structure View as rectangles with the element name inside the rectangle, or you can display the element boundaries as tags so you can see the beginning and end of each element in your content. You can also display the element boundaries as square brackets, although this is not as clearly descriptive as the using the tags.

    Element names can be created by each individual company, and the rules about how the elements fit together can be crafted for specific needs. Essentially, a set of elements is created for each type of document that is published-with some companies working with several DTDs-to produce several different document types. 
     
    <?xml version="1.0" encoding="UTF-8"?>

    <Recipe Category="Other">
    <Name>French Baguettes</Name>
    <Ingredients>

    <Item><Quantity>1</Quantity><Unit> cup</Unit>
    <ItemName> water</ItemName></Item>
    <Item><Quantity>3</Quantity><Unit> cups</Unit>
    <ItemName> flour</ItemName></Item>
    <Item><Quantity>1 1/2</Quantity><Unit> tsp</Unit>
    <ItemName> bread machine yeast </ItemName></Item>
    <Item><Quantity>1 </Quantity><Unit></Unit>
    <ItemName>egg yolk </ItemName></Item>
    <Item><Quantity>1</Quantity><Unit> tsp</Unit>
    <ItemName> water </ItemName></Item>

    </Ingredients>

    <Procedure><Step><Para>Measure carefully, and place 1 cup water, bread flour, sugar, salt, and yeast into bread machine pan in the order recommended by manufacturer. Select Dough/Manual cycle.</Para></Step>
    <Step><Para>Place dough in a greased bowl, turning to coat all sides. Cover. Let rise in a warm place for about 30 minutes, or until doubled in bulk. Dough is ready if indentation remains when touched.</Para></Step> <Step><Para>Punch down dough. Roll into a 16 x 12 inch rectangle on a lightly floured surface. Cut dough in half, creating two 8 x 12 inch rectangles. Roll up each half of dough tightly, beginning at 12 inch side. Roll gently back and forth to taper end. Place 3 inches apart on a greased cookie sheet. Make 1/4 inch deep diagonal slashes across loaves every 2 inches, or make one lengthwise slash on each loaf. Cover. Let rise in a warm place for 30 to 40 minutes, or until doubled in bulk. </Para></Step>
    <Step><Para>Heat oven to 375 degrees F (190 degrees C). Mix egg yolk with 1 tablespoon water; brush over tops of loaves. </Para></Step>

    Figure 1. This shows an XML sample with element nesting.

    Attribute

    Extra information may be attached to an element as an attribute. Attributes can add information regarding the element's content. They can also be used by software applications and style sheets to adjust formatting. An example of an attribute for a chapter element is an Author attribute. In Figure 1-1, you can see a Category attribute with a value of Other within the <Recipe> element.

    The Category attribute provides additional data about the Recipe. It may be used to select an image when the XML is displayed, or it may be excluded in the resulting FrameMaker document's display.

    Attributes have a name-value pair, meaning that they have a name and a value to go with that name. For instance, if an author attribute is created for a chapter element, the value would be the author's name. The value is inserted by the document's creator, although some limitations on the value can be designed into the attribute definition.

    Attributes are created along with the elements, and formatting rules based on the attribute values can be written inside the FrameMaker element definitions.

    DTD

    An acronym for Document Type Definition, the DTD is the list of elements, attributes, and other constructs that are used to create XML structure.

    The DTD specifies the elements that can be used in an XML document. The DTD also contains rules regarding how frequently an element can be used, when elements can be used, the order in which elements must be used, what attributes the elements must have, which attributes have to be given values, and what elements can be used inside other elements.

    You can either use a DTD that is created specifically for your company's documents, or an industry standard DTD. DocBook is one such standard, as is XHTML. If different types of documents are being created, then a company may decide to work with multiple DTDs.

    Brought into FrameMaker, a DTD becomes an EDD and may then be edited to add formatting. A DTD can also be created from a FrameMaker EDD, if that is what you have to work with.

    NOTE: An EDD is a FrameMaker document that includes DTD-like element information alongside formatting rules.

    If an XML document or Structured FrameMaker document is following all of the rules of a DTD, then that document is considered to be valid. If it is not following all of the rules (using an element, for example, in a location where it is not specified in the DTD that it can be used) but it is following all of the rules of XML, then it is considered to be well-formed

    This chapter is from XML and Framemaker, by Kay Ethier (Apress, 2004, ISBN: 159059276X). Check it out at your favorite bookstore today.

    Buy this book now.

    More XML Articles
    More By Kay Ethier


     

    XML ARTICLES

    - Using Regions with XSL Formatting Objects
    - Using XSL Formatting Objects
    - More Schematron Features
    - Schematron Patterns and Validation
    - Using Schematron
    - Datatypes and More in RELAX NG
    - Providing Options in RELAX NG
    - An Introduction to RELAX NG
    - Path, Predicates, and XQuery
    - Using Predicates with XQuery
    - Navigating Input Documents Using Paths
    - XML Basics
    - Introduction to XPath
    - Simple Web Syndication with RSS 2.0
    - Java UI Design with an IDE







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek