What is the purpose of XML?
What can this language do that others such as HTML, CSS, or PHP can't do?
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.
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:
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.
<item invNumber="38C-192" name="Lid - 32oz Coffee">
<description>Lids for 32oz coffee cups</description>
<item invNumber="08N-231" name="Napkins - White">
<description>8oz pkg. of white pre-folded napkins</description>
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.
Ultimate Purpose of XML
Encode (mark up) data only once (not once per product)
Construct many products from that markup
Reuse data (in whole or part) many times
websites and online syndication
ebooks and publishing to other devices (PDAs)
electronic archives for search and reuse
new product opportunities
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.
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.
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.
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.
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
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.
Originally Posted by felgall
Users Browsing this Thread
There are currently 2 users browsing this thread. (0 members and 2 guests)