Click to See Complete Forum and Search --> : What is the purpose of XML?


bobalj
06-26-2008, 10:49 PM
What can this language do that others such as HTML, CSS, or PHP can't do?

felgall
06-26-2008, 11:09 PM
The latest version of Microsoft Office now uses XML for its file formats. They are Word documents and Excel spreadsheets etc and not web pages and so can't use HTML but they can use XML because you can define whatever tags you need with XML and are not limited to those just for web pages.

You can also have information stored as XML that is fed through one filter to create a web page of that content and a completely different filter to produce the same content for a completely different media.

XML is also the ideal intermediate format for transferring data between any other formats. Say you have 10 different programs that need to be able to share data and each has its own proprietary format. To convert from any one proprietary format to any other directly would require 90 different filters to do the possible conversions. Converting to and from XML would only require 20. There are a lot more than 10 different programs in the world that people want to share data between.

rpgfan3233
06-26-2008, 11:58 PM
felgall essentially explained the uses for it. The concept is that XML is a text-based data storage method. You can use whatever markup you want:
<inventory xmlns="urn:ABCo">
<purchaseDate>2008-06-22</purchaseDate>
<deliveryDate>2008-06-25</deliveryDate>
<item invNumber="38C-192" name="Lid - 32oz Coffee">
<quantity>3</quantity>
<description>Lids for 32oz coffee cups</description>
</item>
<item invNumber="08N-231" name="Napkins - White">
<quantity>4</quantity>
<description>8oz pkg. of white pre-folded napkins</description>
</item>
</inventory>

Simple, right? Elements or attributes, it doesn't matter. They could have been done just as easily either way. Sometimes it makes more sense to use one instead of the other, but occasionally the choice isn't terribly easy.

You can define a grammar using an XML DTD, an XML Schema, a Relax NG schema, or any combination thereof, so that any document created using that format must conform specifically to that grammar.

You can transform it into HTML, XML, XHTML or possibly even a simple text format like CSV using XSLT documents.

You can still style it using CSS as well.

I will say that XML languages are not programming languages, per se, like PHP or C++ are. Things like XPath are simply tools used to aid in the programming aspect of using the XML document. XSLT is simply an XML-based grammar used to manipulate the way XML should be rendered.

newagesmb
06-27-2008, 03:20 AM
Encode (mark up) data only once (not once per product)
Construct many products from that markup
Reuse data (in whole or part) many times
print publications
websites and online syndication
ebooks and publishing to other devices (PDAs)
electronic archives for search and reuse
new product opportunities

bogocles
07-01-2008, 06:27 PM
To be honest, you're unlikely to get any "epiphany moments" until you actually start using it. And I don't mean you make an inventory of your personal library and then sit back and look at a screen full of XML. That's not really putting it to use. I mean making that data DO something. And believe me, there are thousands of applications designed to take XML inputs and deliver it as outputs.

The easiest thing to do IMO is to make some XML, link an XSLT to it, and then turn it into a web page (XHTML). Beyond that, the sky's the limit, but XSLT is one of the earliest and easiest things you can use to make your XML DO something. Believe me, you're not going to develop an appreciation for the technology if you're not doing something with it. I know that was my biggest hurdle.

In web development, XML can be useful by being dynamically generated on the server, sent to the client browser along with an XSLT, and recompiled into (X)HTML on the client side, taking some burden off the server.

Personally, I find XSL's ability to script JavaScript makes working with XML data down right fun. Possibilities are endless here. And pretty much everywhere else.

felgall
07-01-2008, 10:31 PM
The 'epiphany moment' will most likely occur when you set up a second XSLT that converts the XML into another format (such as a Word document) allowing you to have the same XML source producing 2 (or 1,000) different formats for the same data so that it can be used everywhere you need to without having to rewrite anything. Make changes to the XML and all the different formats are updated automatically.

wikiman
07-02-2008, 08:27 AM
You guys seem to be very knowledgeable in XML, so can you shed some light on how the search engines can deal with dynamically rendered pages from XML data files? I'm planning a wikipaedia-type site and really need to get a handle on this.

Thanks.

Declan1991
07-02-2008, 10:53 AM
Just make sure that you use GET variables to dynamically load the page, not POST. As far as I know, GET will be indexed, POST will not.

Mr Initial Man
07-03-2008, 02:54 PM
One use I found for XML was containing information to be parsed with PHP. There is absolutely no presentation information for this type of file; that is not its purpose. Its purpose is to contain commentary too long to be easily edited in PHPMyAdmin

bogocles
07-03-2008, 03:59 PM
... allowing you to have the same XML source producing 2 (or 1,000) different formats for the same data so that it can be used everywhere you need to without having to rewrite anything.

Also another awesome feature of XML. The idea that content should be separate from form is embodied in XML. One content source, thousands of potentially different formats.