Click to See Complete Forum and Search --> : What problem did XML solve?
callumd
01-07-2008, 11:35 PM
Hi,
Just trying to get a solid grounding in XML, but can't find anywhere that gives a clear answer as to what problem XML is attempting to solve.
Thanks in advance.
scragar
01-07-2008, 11:51 PM
http://xml.com/pub/a/98/10/guide0.html?page=2#AEN78
they asked the same question.
there is also:
http://www.softwareag.com/xml/about/xml_why.htm
callumd
01-07-2008, 11:59 PM
Thanks scragar.
The reason given is "XML was created so that richly structured documents could be used over the web."
But I thought that's what HTML was created for.
The next sentence is: "The only viable alternatives, HTML and SGML, are not practical for this purpose."
Which forces us to conclude that web pages are not "richly structured documents", at least according to the author of the article. But no definition is provided for this term?
Additionally, where are these XML documents? I use the web a lot, would I have ever encountered one?
scragar
01-08-2008, 12:10 AM
rss feeds are xml, as is almost anything recived by ajax...
xml is about information, so is html technicaly, but while HTML is about displaying and styling it with CSS, XML is about describing the information and applying a structure.
it really shouldn't use the word documents in that first sentence, it's misleading. xml is more concerned with the tree of information that most other methods are capable(it's not very hard to express 2d or 3d arrys in xml, while databases find these tend to involve several tables).
callumd
01-08-2008, 12:58 AM
Could the function of RSS not be achieved with HTML, using the ID attribute?
<html id="rss feed">
<h1 id="topic">News for today</h1>
<p id="newsitem">Bombs exploded today...</p>
<p id="newsitem">Knicks win 91-89...</p>
</html>
callumd
01-08-2008, 01:00 AM
Hmmm,
On second thought, I could see in some instances where XML could be more flexible than HTML, if a piece of information doesn't fall neatly in to the category of a "heading", "paragraph" or some other pre-defined HTML tag.
scragar
01-08-2008, 01:31 AM
xml is about data, not layout.
when was the last time you read an rss feed that wasn't turned into a list of messages? When using firefox do you look at your downloads list as an xml document?
XML is data, it's more for the machine that for people, but it CAN be read by people, that's what is so good about it, if you used a normal database then you couldn't edit the databse without needing some program capable of reading, then editing the database while providing you with some form of front end.
XML cut's this out, you can edit it with notepad or vim if you wanted, it is a databse in text form.
it's even better than a database in many ways as well, for example a normal database will rely on 2d tables, this means that to embed something in 3 levels of information 2 tables are needed, with a common paramiter between them. for 4 levels that needs a 3rd table. XML allows you to embed down to as many levels as you require(up to around 38,000 or so is where most computers become incapable of continueing to render it, however this is not nessesseraly the limit of xml, just the program interpriting it).
callumd
01-08-2008, 01:48 AM
When using firefox do you look at your downloads list as an xml document?
I had no idea that the Firefox download list was an XML document. How can you tell this, and is there any way to view the XML?
Another question: When does something become XML? Writing out posts on this forum, I use tags like "quote" and "php". Why isn't this XML?
Or is it?
scragar
01-08-2008, 01:59 AM
not sure where it is on windows, but on linux it'll be stored under:
~/.mozilla/firefox/*.default/downloads.rdf
I can post you a sample if you like:
<?xml version="1.0"?>
<RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#"
xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<RDF:Seq RDF:about="NC:DownloadsRoot">
<RDF:li RDF:resource="/home/scragar/Desktop/logo.gif"/>
</RDF:Seq>
<RDF:Description RDF:about="/home/scragar/Desktop/logo.gif"
NC:Name="logo.gif"
NC:Transferred="1kB of 1kB">
<NC:URL RDF:resource="http://www.google.co.uk/intl/en_uk/images/logo.gif"/>
<NC:File RDF:resource="/home/scragar/Desktop/logo.gif"/>
<NC:DateEnded NC:parseType="Date">Tue Jan 08 06:56:50 GMT 2008 +287489</NC:DateEnded>
<NC:DownloadState NC:parseType="Integer">1</NC:DownloadState>
<NC:ProgressPercent NC:parseType="Integer">100</NC:ProgressPercent>
</RDF:Description>
</RDF:RDF> just incase your wondering, this was after downloading the google logo and nothing else(I don't use firefox as my default browser). It uses a version of XML(like rss is also a version) called rdf.
callumd
01-08-2008, 02:12 AM
Interesting, thanks for posting it.
I am assuming that RDF has a related XML "doctype", yes?
Also, you may have missed my other question: When does something become XML? The tag-based nature of posts on this forum, I am guessing, is not XML. But why?
scragar
01-08-2008, 02:30 AM
xml tends not to have doctypes, those are reservered for html, the exception being xhtml which is a merge of the 2, taking the syntax and order of xml and the features of HTML.
instead of doctypes, you get namespaces. these are short little things that go infront of tag names, unlike HTML doctypes though, you arn't limited to a single namespace in XML(you can see on the firefox downloads list it uses RDF and NC), infact you don't even have to use namespaces, they are just recomended.
the forum is not xml because it has a style built in way of the tags. Although both xml and HTML can have styling due to CSS, in XML no tag has a default style, in HTML most do("display: block" for divs and p's counts as a style, as does "font-weight: bold" for b and strong... etc.).
XML is information, and rules defining that information, not for interpriting or displaying it.
callumd
01-08-2008, 08:08 AM
Right, right.
Thanks for your help.
scragar
01-08-2008, 08:22 AM
oh, the closest you actualy get to a doctype is the xml declaration:
<?xml version="1.0"?> is a rather simple one, most contain info on their character sets and such. the declaration is optional, though it is highly recomended you do not ommit it for compatability with future versions.
And I'm sure someone out there has more to say on this particular subject than what I've said.