Introduction to XML

Before starting to learn the techniques of building a web service, it helps us understand the basic concepts of XML. An understanding of XML will help us to more easily understand what is happen behind the web service. For readers who already understand the basic concepts of XML, can skip the discussion in this chapter.

What is XML?
XML lies at the core web service, which is used to describe data. The main function of XML is the communication between applications, data integration, and communications with external partner application outcomes. With the standardization of XML, different applications can easily communicate between each other.


XML stands for eXtensible Markup Language. Markup language is a set of rules that defines a syntax that is used to explain, and describe the text or data in a document through the use of tags. Another popular markup languages like HTML, describes the web browser on how to display text formatting, data, and graphics to the computer screen while visiting a website. XML is a markup language used to process the meta data (information about data) which describes the structure and intent / purpose of the data contained in XML documents, but rather describes the display format of the data. XML is a simple standard that is used to describe text data in a way self-describing (self description). XML can also be used to define other specific domains, such as music, mathematics, finance and others that use structured markup language.

Here is an example of an XML document to the information contact person:

<?xml version="1.0" encoding="ISO-8859-1"?><contact>
<contact>
<name>Jack</name>
<company>Intel, Inc</company>
<address>Backstreet 43</address>
<city>Los Angeles</city>
<state>United States</state>
<zip>99999</zip>
<phone>0811111</phone>
<email>jack@gmail.com</email>
</contact>

Notice how easy it is to understand the meaning and structure information on the above XML document, so it will also be easy for computers to understand this XML document.
Like HTML, XML uses elements that are marked with an opening tag (starts with '<' and ends with a closing tag '>'), (starts with '</' terminated '>') and attribute elements (the parameters stated in the tag e.g. <form name="content"> opener). Only difference, define HTML tags and attributes from the beginning that is used in it, whereas we can use the XML tags and attributes at will.

Writing an XML Document Structure
Here is an example of an XML document structure:

<? xml version = "1.0" encoding = "ISO-8859-1"?> --> Header

<email> --> Root element
<to> Jason </ to> --> child element
<from> Jack </ from> --> child element
<subject> Hello </ subject> --> child element
<message> Good Morning ... </ message> --> child element
</email>

The first line in the XML document above is a standard declaration header that defines the XML version and character encoding used in XML documents. In this document, refers to the version of XML 1.0 and uses the character set encoding standard ISO-8859-1 (European Latin-1/West).
The next line describes the parent element (root) document "<email> .. </ email>", as we call that "This document is an Email". Then the line to 3-6 illustrate the elements of a child (child) from the parent element of the document.
Tag in the XML document are case-sensitive where the opening tag and closing tag must be equivalent. As an example the opening tag "<email>" must be closed with the tag "</email>".

Here is an example of writing an XML document that is not true:
"<email> .... </Email>"
"<EMAIL> .... </Email>"
"<email> .... </EMAIL>"
Here is an example of writing a correct XML document:
"<email> .... </email>"
"<EMAIL> .... </EMAIL>"
"<Email> .... </Email>"

0 comments:

Post a Comment