Your source for ASP-related frequently asked questions and answers! : ASP FAQS : XML

Question: What is XML?

Answer: This FAQ was written by Doug Setzer and Scott Mitchell

XML stands for eXtensible Markup Language. Simply said, XML is a method of representing data. You can think of XML as a database. XML is stored in a document in a hierarchical fashion, with there being a root node and child nodes underneath of it.

Some Examples
A good example of XML document is a simple HTML page:

<title>My Document Title</title>
My document body.

At a glance, you can see that we are working with a "html" document.
There is header data defined. More specifically, we have given a "title" to our document. The body of the document is clearly denoted, as well.

Taking that same idea, say we have a set of cars. Each car has data about

- Make
- Model
- Trim Level
- Type of Car
- # of Doors

One design of XML would be:

<type_of_car>Sports Sedan</type_of_car>

As you can easily see, we have my 2 favorite cars. A Chrysler 300M
Special and a Chevrolet Corvette.

XML Syntax Specifics
When working with XML, there are some important syntactical issues to keep in mind. First, XML is case-sensitive, meaning that the tag:




Are considered different tags. Furthermore, XML documents must be properly nested. That is, each tag must have a start and end tag, and, when declaring a tag within another tag, it is vital that the inner tag's closing tag appears before the outer tag's closing tag. For example, the following is an example of illegal XML syntax due to improper tag nesting:


Since the make tag is declared within the <car> tag, the closing tag (</make>) must appear within the <car> tag. Another problem is that the <color> tag does not have a matching close tag.

Due to these syntactic rules, all valid HTML Web pages are not necessarily valid XML documents. This is because HTML is case-insensitive and allows for improper tag nesting. There is, however, a variant of HTML called XHTML that requires conforming HTML documents to be syntactically correct XML documents.

Using XML
So, that's all fine and dandy, you say. But, how do you *use* XML? There are a hundred and one answers to that. First, you could use it as a database instead of Access, Sql Server or Oracle. Second, you could take that data and send it to a car buying service. Third, you could build that XML from your database to separate the front-end display of your site from the data retrieval.

The benefit of XML is that it is text. This means that it can easily be shared among disparate platforms, and across firewalls. In English, this means that XML is an excellent way to transfer data from one Web server to another. For example, if you want to syndicate content from your Web site to other Web sites, such as the AP and Reuters Web sites do, you can provide your content in an XML file that other Web sites can programmatically access and incorporate into their Web pages.

Learning More About XML
In addition to reading the other XML FAQs, you can learn more about XML by checking out the following articles:

* Getting Started with XML
* Server-side XML in ASP
* XML: SuperGlue for the Web
* XML Basics
* Learning XML (a book)

FAQ posted by Scott Mitchell at 2/17/2003 1:12:58 PM to the XML category. This FAQ has been viewed 50,061 times.

Copyright 2017 QuinStreet Inc. All Rights Reserved.
Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers