Welcome to WebmasterWorld Guest from 220.127.116.11
Forum Moderators: httpwebwitch
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<title>Dilvish, the Damned</title>
Now how can you use that info? Well, I can move it around just by sending you the text. I can parse it and get the pieces. Think of it much the same way that you would think of a database, except that it is a lot simpler and non-proprietary.
One thing I can do is apply an XSLT (eXtensible Style Language Transformation) style sheet to it. Think of XSLT as a simple scripting language. The script, though, is written as XML (this starts getting recursive after a while!). For example:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8" indent="yes"/>
<li><xsl:value-of select="author"/>: <xsl:value-of select="title"/></li>
The output of the transformation is:
Now how you do that applying depends on what environment you are developing under.
Another way to work with it is to use the Document Object Model (DOM) to walk through the nodes. You need a parser, but the interface to the parser is a W3 spec, found here: [w3.org...]
There are also other different parsers.
So XML is just marked up data. The question is what do you want to do with the data? I tend to use XML in many places that I would formerly have used a database as it is easier to write and maintain.
I'm new to the concepts of XML: so is that completely cross-browser friendly?
Meaning the now-dreaded NN4 - can it parse XML?
Also: are there any HTML to XML programs out there (I mean, I get that you need to mark the data up, but anything that would take the basic HTML and make it lower case, etc.)
Finally: can you use XML for things like navigation menu includes?
As far as converting HTML to XHTML, there is a program called HTML Tidy available on the W3 web site that will do it for you. Available from here: [w3.org ]. XHTML is HTML coded to the XML rules. Questions about it should be posted in the HTML forum.
XML is just data. So what you use it for and how you use it is up to you. It doesn't implicitly do menus.
For other environments, you'd need a different parser and different scripting code. Depends on the environment on how that would work. But the basic scheme is the same. You get the XML, you get the XSL, you apply one to the other producing HTML, you send the HTML to the client.