Click here for Vacation Photos

XML Basics

XML (Extensible Markup Language) is the industry standard for the interchange of data. Be aware of the following about XML:

  • XML is a universal language for the representation of data.
  • XML facilitates sharing data between computers across a network, software applications, databases, etc.
  • XML is plain text, easy to read, create, and parse.
  • XML data is stored as Unicode UTF-8.
  • XML is an open standard that anyone can use.
  • XML is not a data presentation language like HTML. It only describes the data, not the layout or format of the data.

XML is a self-describing tagged markup language and a subset of SGML. The following table describes the components of XML.

Component Description
XML Declaration The XML declaration is typically the first line in an XML document.


  • The declaration is optional, but when it appears, it must be the first line in the document.
  • It begins with .
  • It includes a version number (currently 1.0) and, optionally, an encoding scheme. Unicode UTF-8 encoding is usually used.
Elements XML elements are tagged sections of data.


Some Data;
  • Tags look like HTML tags except each opening tag is required to have a closing tag or be closed explicitly.
  • Elements may have any name with the only restriction that the closing tag has the same name.
  • Tags surround the data and, optionally, other tags.
  • The first element in the file is called the root element.
  • Closing tags contain the tag name preceded by a forward slash /.
  • A self-closing tag ends with /> and cannot have a separate closing tag. In the example to the right, is a self-closing tag. Note that self-closing tags cannot contain data.
  • Tag names do not have to be unique in a given file.
Attributes Attributes reside inside a tag and are used to describe the data.

Some Data;
  • Attributes can hold any value but should only be used to describe the data (they should not contain the data directly.)
  • Attributes are inside a tag after the tag name.
  • An attribute consists of the attribute name followed by the attribute information.
Data Data is stored between element opening and closing tags. It is in plain text, usually UTF-8 Unicode.
Some Data;
Comments Comments are elements that are not read as data or otherwise displayed.

To be valid, XML must be well-formed; that is it must adhere to the following rules:

  • The document must have exactly one root element.
  • Elements must be open and closed in the same context. In other words, elements must be nested without overlapping opening and closing tags.
  • Each element must have an opening tag and a closing tag or else be self-closing.
  • Data must appear inside elements.

XML allows for a description of the XML document itself to be created called a schema. A schema describes a contract that both the transmitter and the receiver of the XML document agree to follow. While the XML document holds the data, the schema defines the structure of that data. It is the schema that allows both parties to understand fully what the tags and attributes mean and defines the context that the data structure is allowed within the XML document. XML schemas are used to create thousands of XML-based languages in use today. Some of these languages include SOAP, WSDL, and many other open source and proprietary languages.



Digg it | Save to del.icio.us | Netscape | Reddit | Stumble It!

- - - - - S P O N S O R I N G     A D V E R T I S M E N T - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Post your thoughts in the Comments ...
Not signed up to share your ideas & thoughts?

It’s free and easy to collaborate!
Click Here to begin

Click Here to earn money for reviewing this post

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Leave a Reply

You must be logged in to post a comment.