What is XML?

HTML and XML

XML File Sample

   <?xml version="1.0"?>
   <dining-room>
      <manufacturer>The Wood Shop</manufacturer>
      <table type="round" wood="maple">
         <price>$199.99</price>
      </table>
      <chair wood="maple">
         <quantity>6</quantity>
         <price>$39.99</price>
      </chair>
   </dining-room>

XML describes Structure and Semantics, Not Formatting

HTML Example
   <DL>
   <DT>Mambo
   <DD>by Enrique Garcia
   </DL>
   <UL>
   <LI>Producer: Enrique Garcia
   <LI>Publisher: Sony Music Entertainment
   <LI>Length: 3:46
   <LI>Written: 1991
   <LI>Artist: Azucar Moreno
   </UL>

XML describes Structure and Semantics, Not Formatting (2)

XML Example
   <SONG>
      <TITLE>Mambo</TITLE>
      <COMPOSER>Enrique Garcia</COMPOSER>
      <PRODUCER>Enrique Garcia</PRODUCER>
      <PUBLISHER>Sony Music Entertainment</PUBLISHER>
      <LENGTH>3:46</LENGTH>
      <YEAR>1991</YEAR>
      <ARTIST>Azucar Moreno</ARTIST>
   </SONG>

What's So Great About XML?

Easy Data Exchange

What's So Great About XML? (2)

Customizing Markup Languages

What's So Great About XML? (3)

Self-Describing Data
   <?xml version="1.0" encoding="UTF-8"?>
   <DOCUMENT>
      <GREETING>Hello from XML</GREETING>
      <MESSAGE>Welcome to Programing XML in Java</MESSAGE>
   </DOCUMENT>

What's So Great About XML? (4)

Structured and Integrated Data
   <?xml version="1.0"?>
   <SCHOOL>
      <CLASS type="seminar">
         <CLASS_TITLE>XML In The Real World</CLASS_TITLE>
         <CLASS_NUMBER>6.031</CLASS_NUMBER>
         <SUBJECT>XML</SUBJECT>
         <START_DATE>6/1/2002</START_DATE>
         <STUDENTS>
            <STUDENT status="attending">
               <FIRST_NAME>Edward</FIRST_NAME>
               <LAST_NAME>Samson</LAST_NAME>
            </STUDENT>
            <STUDENT status="withdrawn">
               <FIRST_NAME>Ernestine</FIRST_NAME>
               <LAST_NAME>Johnson</LAST_NAME>
            </STUDENT>
         </STUDENTS>
      </CLASS>
   </SCHOOL>

Well-Formed XML Documents

Valid XML Documents

     <?xml version="1.0" encoding="UTF-8"?> 
     <?xml-stylesheet type="text/css" href="first.css"?>
     <!DOCTYPE DOCUMENT [                  
        <!ELEMENT DOCUMENT (GREETING, MESSAGE)>                  
        <!ELEMENT GREETING (#PCDATA)>
        <!ELEMENT MESSAGE (#PCDATA)>
     ]>

     <DOCUMENT>
        <GREETING>Hello from XML</GREETING>
        <MESSAGE>Welcome to Programing XML in Java</MESSAGE>
     </DOCUMENT>

Related Technologies

Hypertext Markup Language

Related Technologies (2)

Cascading Style Sheets

Related Technologies (3)

URLs and URIs

Related Technologies (4)

The Unicode Character Set

How Do I Use XML?

XML Flowchart

Simple API for XML - SAX

Document Object Model - DOM

Sun's Java API for XML Parsing - JAXP

Java and XML: A Perfect Match

The Life of an XML Document

Life of an XML Document

XML Editors

Create XML documents

XML Editors (XML Spy)

XML Spy Screenshot

More XML Spy

XM Spy Grid Screenshot

XML Parsers

  1. Read XML Document
  2. Verify that XML is well formed
  3. Verify that XML is valid

XML Validators

Verify that XML is valid

XML Validator Screenshot

XML Browsers

Display the Data to the User

XML Resources

XML Applications

Languages based on XML