What's the point of XML?

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

What's the point of XML?

Post by evilmonkey »

Hello,

I searched the internet left and right for the answer to this question, but so far I couldn't find anything comprehensible. It seems like, okay, you make your own markup, now what? The browser can't read it, you're stuck with a bunch of plan text to which you have to write your own parser (be in PHP or some other language). If that's so, what's the point of the XML standard? Did I miss the point entirely? Time for XML discussion. :D

Cheers!
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

I think it's all about cross platform capability, but I don't buy into that to much. I think it would be easier just to write a script that would format the data in a csv format or something similar. I have never really been to impressed with XML from what I have seen.
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

Data. It stores information in an "array" of sorts. It's more or less a portable database. Among other useful things.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: What's the point of XML?

Post by Chris Corbyn »

evilmonkey wrote:Hello,

I searched the internet left and right for the answer to this question, but so far I couldn't find anything comprehensible. It seems like, okay, you make your own markup, now what? The browser can't read it, you're stuck with a bunch of plan text to which you have to write your own parser (be in PHP or some other language). If that's so, what's the point of the XML standard? Did I miss the point entirely? Time for XML discussion. :D

Cheers!
Actually the browser can read it. You just need to write a DTD for it ;)

XML parses extremely easily too... this makes it excellent for config files.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

agtlewis,

care to mock up a 6 dimensional CSV file for me to show me how that would work?


It's basically a data abstraction thing, if you are downloading data for the weather for multiple zipcodes from a weather service for example

Code: Select all

<weather>
 <zip code = "33458">
   <temps>
     <high>82</high>
     <low>75</low>
    </temps>
 </zip>
 <zip code = "90210">
   <temps>
     <high>80</high>
     <low>73</low>
    </temps>
 </zip>
</weather>
It's just a really convenient way to move data from place to place, to store hierarchical data, etc.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

The browser can't read it, you're stuck with a bunch of plan text to which you have to write your own parser (be in PHP or some other language)
xml_parse() ;)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Extensible Markup Language - says it in the name.

It is a standardized way of structuring information (markup language), but without a specific set of tags. It is entirely flexible in that anyone or any program can create their own "format" as an extension to accomidate their data. Anything can be stored in XML files as it, in the end is just a very basic and loose file interchange specification.
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

feyd wrote:Extensible Markup Language - says it in the name.

It is a standardized way of structuring information (markup language), but without a specific set of tags. It is entirely flexible in that anyone or any program can create their own "format" as an extension to accomidate their data. Anything can be stored in XML files as it, in the end is just a very basic and loose file interchange specification.
That's nice. By the same token, I can do this:

Code: Select all

Name: evilmoneky
Postcount: 675
Location: Toronto
as opposed to

Code: Select all

<name>evilmoneky</name>
<postcount>675</postcount>
<location>Toronto</location>
Then write a program that will scan that text for a colon
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

XML wasn't really meant to be written by hand. It is best written by a computer for other computers. As I said before, it is an interchange format. Just like JFIF, RIFF, and several other file formats you may know.
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

Ah, alright...now it's starting to make sense...
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

evilmonkey wrote: That's nice. By the same token, I can do this:

Then write a program that will scan that text for a colon
And what happens when the text has a colon in it? Or multiple? What if the colons are meaningful?

Thats the beauty of a standard data interchange format. Instead of having to write a 3,000 line html parser for yahoo finance, AND a 2,000 line html parser for phpdn, AND.. AND..

Each with custom "check for a colon, and then a paragraph tag, and then .. " logic, you can simply do an xml pull, and start traversing the tree.

Standard data interchange formats mean you can consistently access data from multiple sources in a reliable format.
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

So here's what I'm getitng: basically it's data, in a structured form. You know the structure, but you have no idea what kind of data to expect. Like a grade 9 English essay, the rules of XML can't be bent to accommodate an "artistic style". You have to write your own parser. You need to have a vague idea of what the data is for the paser to be meaningful. XML is means to an end, it is by no means the be-all, end-all, nor does it really do anything on its' own. I'm starting to see its uses for certain things, but nothing I'm working on at the moment (that's why I wanted to know what the use of it is).

This thread was inspired by a quote I found while researching XML: "XML is a giant leap in no direction at all". Just wanted to know what people use it for.
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

Most frequent use of XML:
RSS Feeds.... If you want to update you site with information from another, RSS is the way to go.
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

Coming from a documentation stand point I view XML as a "structured content" component of information where a normal document has both structural content and format.

Consider XML as being similar to HTML without any format. (i.e HTML=structure and CSS=format) Now you can use a Document Type Definition to ensure that you fulfill certain criteria, e.g <h2> must follow an <h1> and so on (remember no format). Rather than a <bold> tag you have <emphasis> and/or <index>. It means a company can have a standard structure which aids both human and computer reading. (It is often the case that a structure/the format of the document changes depending on what side of the bed a person gets up on). Knowing that <h1> always is first means getiing all <h1>'s in all documents it likely to give us the document title. Using XML and DTD's can even help checking if documentation fullfils contractual obligations (Technical Writers often have to structure/format a document in a specific way, especially in military contracts).

Now add to this some intelligence coding (Automatic index, table of contents, glossary words etc) which have all been "correctly" tagged in the document. Complex documentation is simplified...

Then add format aspects to the XML similar to using different CSS files in HTML. Screen/Printer/Mobile etc can each be formatted in a different way, emphasis can be coloured or underlined in a way which enhances the user experience (that's why I used emphasis rather than bold). The same document could have different accessibility levels to show more information to specific people or any number of things.

When transfering information between systems format has "no" value. It is not needed and processing it is often an overhead so XML is often used to simplify transfering information in a standard way.

Another useful aspect is potentially reusability. If a paragraph is used in multiple places we simply place a tag reference to this and our "system code" automatically fills it in for us reducing the chance of typing errors.

Of course with anything like this there are downsides. Parsing is not always simple especially in complex DTD's, especially for non-techie people. People often find the idea of separation of content and format hard to comprehend, (what is the difference between bold and emphasis ?). DTD's can be a nightmare etc, etc..

A lot of people of jumped on the "bandwagon" without realising what XML is, it's benefits and disadvantages and so it's use is often abused (the same thing is happening with Ajax) but it is a very powerful tool in any "techhie" toolkit.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

XML is great. If you're a manager it's a useful buzzword that you can use in meetings to give people the impression you're right on the bleeding edge of web development.

See also: AJAX, JSON, Blogosphere.

No?
Post Reply