After you read my article few days ago, XML - Introduction to XML Programming, now you have an understanding of what XML is and how it works, it’s time to learn how to apply your knowledge and design your own set of XML markup tags, and then use those tags to write your first XML document. In this article, you’ll learn step-by-step how to do this, along with other design features, to build a working XML document that enables you to share information electronically among various applications.
This section follows an old programmer’s tradition of introducing a new language with a program that prints “Hello World” on the console. XML is a markup language, not a programming language; but the basic principle still applies. Let’s do that.

Creating a Simple XML Document

In this section, you’ll create a simple XML document and save it in a file. Code below is about the simplest XML document I can imagine, so start with it. You can type this document in any convenient text editor, such as Notepad, G-Edit, or Emacs.

Hello.xml

<?xml version=”1.0”?>
<root>
Hello XML!
</root>


That code is very simple, but it is a good XML document. To be more precise, it is a well-formed XML document. XML has special terms for documents that it considers “good” depending on exactly which set of rules they satisfy. “Well formed” is one of those terms, but we’ll get to that later.

Loading the XML File into a Web Browser

Now that you’ve created your first XML document, you’re going to want to look at it. You can open the file directly in a browser that supports XML such as Internet Explorer 5.0 or later. Figure at below shows the result; display Hello.xml in Internet Explorer 6.0.

XML in Browser

Congratulation you finally done your first XML document. Now you’re ready to continue for more advance topic of XML. Ha ha, it’s very little knowledge about XML, but it’s very useful to you, especially the root tag, so don’t be underestimate with those tag, I’ve tell you. See you in next article about XML, DTD – Document Type Definitions.

Sty – Knowledge is Free