Home > Tutorials > XML BASIC CONCEPTS

XML BASIC CONCEPTS

XML, the Extensible Markup Language, is a W3C-endorsed standard for document markup. It defines a generic syntax used to mark up data with simple, human-readable tags. It provides a standard format for computer documents that is flexible enough to be customized for domains as diverse as web sites, electronic data interchange, vector graphics, genealogy, real estate listings, object serialization, remote procedure calls, voice mail systems, and more.

You can write your own programs that interact with, massage, and manipulate the data in XML documents. If you do, you’ll have access to a wide range of free libraries in a variety of languages that can read and write XML so that you can focus on the unique needs of your program. Or you can use off-the-shelf software, such as web browsers and text editors, to work with XML documents. Some tools are able to work with any XML document. Others are customized to support a particular XML application in a particular domain, such as vector graphics, and may not be of much use outside that domain. But the same underlying syntax is used in all cases, even if it’s deliberately hidden by the more user-friendly tools or restricted to a single application.

The first concept to understand XML files is understand Elements, Attributes and Character Data.

For example, if you have a table ‘person’ in a database with columns Id,Name, Age and Address, we can export this information using XML:

<person Id=”555″>
<Name> Gabriel </Name>
<Age> 28 </Age>
<Address> Street XYZ </Address>
</person>

In the first line, we have the element called ‘person’ with an attribute Id with a value ’555′. In the second, third and fourth line we have elements which receives the contents ‘Gabriel’, ’28′ and ‘Street XYZ’.
An element is delimited by the start-tag and the end-tag. Everything between the start-tag and the end-tag of the element (exclusive) is called the element’s content.

Example:
<Name> Gabriel </Name>

XML elements can have attributes. An attribute is a name-value pair attached to the element’s start-tag. Names are separated from values by an equals sign and optional whitespace. Values are enclosed in single or double quotation marks.

Example:
<person Id=”555″>

But… why use XML? For the basics, we can export database data, like table contents to our suppliers, partners and websites.
And more: there´s a lot of DBMS in the world. MySQL, Postgres, SQL, Oracle, DB2…
For now, you understood the basics of XML files, but we have a lot of things to learn, how make any DBMS export data to XML, how manipulate data on XML files…

But… stay calm… we will discuse this topics on anothers posts.

Well.. see you on another post!

*DBMS – Database management system

Categories: Tutorials Tags:
  1. December 16th, 2009 at 18:29 | #1

    Hi, folks. My name is Frank (or MrSpock, because of my ears and my dream). I have started programming in 1985 and I work as a software developer now. I am basically both an old-school programmer (started with Pascal) and a new one (a child of the Internet era HTML, PHP) at the same time. I have basically lost a decade in the programming world. Losing the nineties is not as bad as it seems; I skipped the Windows era ;-)

    My dream in life is to develop affordable space travel and space tourism. As a result I also love collecting space related photos made by both pro’s and amateurs. One of own personal problems is that I tend to become an expert of a subject very quickly, so I have to keep changing subject often in order to stay sufficiently ignorant :-) This is why I am interested in many topics and many languages. Fortunately space travel has so far proven to be so complex that it will keep my attention for a long time :-)

    I’m usually more of just a lurker on the net but I’ll chime in when I feel I need to, looking forward to meeting everyone and being a part of the community! Well I won’t bore you guys and girls any longer, see you all around!

  1. No trackbacks yet.