XML
  Home arrow XML arrow Page 4 - An Introduction to XML
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
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? 
Google.com  
XML

An Introduction to XML
By: Suresh Kumar
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 5
    1999-10-21


    Table of Contents:
  • An Introduction to XML
  • SGML, HTML and XML
  • Valid and Well-formed XML
  • Example XML Documents and analysis
  • Software for XML
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    An Introduction to XML - Example XML Documents and analysis
    ( Page 4 of 6 )

    Example 1 - A well-formed XML document:


    <?xml version="1.0" standalone="no"?>
    <Mail>
    <From>Author</From>   
    <To>Receiver</To>
    <Date> Thu, 7 Oct 1999 11:15:16 -0600</Date>
    <Subject>XML Introduction</Subject>
    <body><p>Thanks for reading<Br/>
    this article</p>
    <br/>
    <p>Hope you enjoyed this article</p>
    </body>
    </Mail>

     


    The first line is the XML declaration and it identifies what follows as XML code. It is called the prolog. The attribute version indicates the version of the XML standard. The statement standalone="no" indicates that markup declarations are external to the document. The XML declaration can be considered as a "processing instruction". Though this declaration is not compulsory, it is better to include such declaration. This will increase the portability of the document.

    Example 2 - A valid XML document conforming to mail.dtd. Date element is missing because it is optional in the mail DTD The element P has the attribute justify. After the Body and before P Comments text is allowed, because DTD allows the use of plain text in the Body element.

    <?xml version="1.0" standalone="no"?> <!DOCTYPE Mail system "http://infowest.com/DTDS/mail.dtd"> <Mail> <From>Author</From> <To>Receiver</To> <Cc>Receiver2</Cc> <Subject>XML Introduction</Subject> <body>Comments:<p align="justify">Thanks for reading<Br/> this article</p> <br/> <p>Hope you enjoyed this article</p> </body> </Mail>

    Example 3 - A valid XML document conforming to "mail.dtd". Date element and Cc elements are present The element P has the attribute right.

    <?xml version="1.0" standalone="no"?> <!DOCTYPE Mail system "http://infowest.com/DTDS/mail.dtd"> <Mail> <From>Author</From> <To>Receiver</To> <Cc>Receiver2</Cc> <Date> Thu, 7 Oct 1999 11:15:16 -0600</Date> <Subject>XML Introduction</Subject> <body>Comments:<p align = "right" >Thanks for reading<Br/> this article</p> <br/> <p>Hope you enjoyed this article</p> </body> </Mail>

    An XML document can have comments. XML's comment syntax is similar to that of HTML. Any text, except double hyphen, "--", can be placed between <-- and --> tags. Processing instruction(PI) can be embedded in the documents. The data components of the PI should be recognized by the processing applications.

    Publishers may want to include some codes that should not be parsed by the parsers. Those codes can be put in to the ignored sections. An ignored section will have the syntax like this:

    <[CDATA[Any text to be ignored]]>

    In simple words, any ignored sections start with <[CDATA[ and end with ]]>

     
     
    >>> More XML Articles          >>> More By Suresh Kumar
     

       

    XML ARTICLES

    - Flex Array Collection Sort and Filtering
    - The Flex Tree Control
    - Flex List Controls
    - Working with Flex and Datagrids
    - How to Set Up Podcasting and Vodcasting
    - Creating an RSS Reader Application
    - Building an RSS File
    - An Introduction to XUL Part 6
    - An Introduction to XUL Part 5
    - An Introduction to XUL Part 4
    - An Introduction to XUL Part 3
    - An Introduction to XUL Part 2
    - An Introduction to XUL Part 1
    - XML Matters: Practical XML Data Design and M...
    - Practical XML Data Design and Manipulation f...





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