Home arrow XML arrow Page 4 - An Introduction to XML

Example XML Documents and analysis - XML

XML is an acronym for "Extensible Markup Language". XML is the latest, powerful , platform-independent and content-dependent technology in the internet development. Learn all about it here.

TABLE OF CONTENTS:
  1. An Introduction to XML
  2. SGML, HTML and XML
  3. Valid and Well-formed XML
  4. Example XML Documents and analysis
  5. Software for XML
  6. Conclusion
By: Suresh Kumar
Rating: starstarstarstarstar / 6
October 21, 1999

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

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
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

XML ARTICLES

- Google Docs and Xpath Data Functions
- 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...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: