XML - Practical uses?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Kimbro Staken
Date:  
Subject: XML - Practical uses?
"Steven M. Klass" wrote:
>
> Hello all,
>
>         I apologize for this potentially lame question, but I am curious and it's
> killing me.

>
> What is the point of XML and what practical benifit would I get from writing
> in it?
>
> I guess I don't understand the differences between firing up vi and typing
> hello or typing <p> hello </p> ? They both say the same thing right? They
> both can be seen by any editor right? So what practical benifits does it
> provide for.
>


I believe I'm scheduled to talk on this subject at the next east side
meeting but here is a two second overview.

<p>hello</p> probably doesn't provide much value but
<greeting>hello</greeting> might. In the second case you're adding
context to the specification of the data that wasn't there other wise.
As a human when you see the term hello you know it generally is used as
a greeting a computer will not know that.

Once you define the context with the data you can then process it a
little more intelligently. For instance if you want to convert it into
HTML you could use XSL-T and define a rule that formats all greetings in
a similar manner.

Here is a trivial example.

With this input
<data>
<name>John</name>
<greeting>hello</greeting>
<greeting>aloha</greeting>
</data>

You could use this XSL-T fragment.

<xsl:template match="greeting">
<h1><xsl:value-of select="."/> <xsl:value-of
select="/data/name"/></h1>
</xsl:template>


Which would simply output

<h1>hello John</h1>
<h1>aloha John</h1>

What is important to note is the presentation of the data is completely
seperate from the data itself. So if you want to target a presentation
you simply change your rules

Here is a more real world example. Take a look at these two pages.

http://www.dbxml.com/news.xml
http://www.dbxml.org/news.xml

Both are generated from the same XML file but simply use different XSL-T
stylesheets to create the presentation. We could create any number of
presentations for this data and not have to touch the original file.

This is probably the most accessible use of XML. There are many, many,
many more. Many of which have other ways of solving the same problems,
XML simply brings some commonality to the solutions and provides a more
robust foundation for advancement.

> Mind you I'm the same guy who asked whats the point of SGML:)
> --
>
> Steven M. Klass
> Physical Design Engineering Manager
>
> Andigilog Inc.
> 7404 W. Detroit Street, Suite 100
> Chandler, AZ 85226
> Ph: 480-940-6200 ext. 18
> Fax: 480-940-4255
>
>
> http://www.andigilog.com
> ________________________________________________
> See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail doesn't post to the list quickly and you use Netscape to write mail.
>
> PLUG-discuss mailing list -
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss


--
Kimbro Staken
The dbXML Project
http://www.dbxml.org/