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
AKA Panama Jack
Forum Regular
Posts: 878
Joined: Mon Nov 14, 2005 4:21 pm

Re: What's the point of XML?

Post by AKA Panama Jack »

d11wtq wrote:
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.
Actually I rather hate XML for config files. The problem is that there is alot of overhead for an decent XML parser, even with what is built into PHP to support it. Plus it is considerably SLOWER to parse an XML config file than it would be to parse your own special configuration file. XML is ok for minimal processing but if you want any speed with PHP it is probably best to avoid it.

XML is a great idea for portability of data between different applications but I would NOT use it for data that has to be processed for every web page because of the slow speed and high overhead. There are far better methods for storing information that is used within your own application. I would only use XML for sharing data between different applications. Such as exporting data that will be imported into another application.
User avatar
AKA Panama Jack
Forum Regular
Posts: 878
Joined: Mon Nov 14, 2005 4:21 pm

Post by AKA Panama Jack »

Jcart wrote:
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() ;)
You still have to write the XML parsing code that is referenced by that function in PHP. :) It will not magically parse the data for you. :)
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

AKA Panama Jack wrote:It will not magically parse the data for you. :)
True.. but there's simpleXML for that..
Gambler
Forum Contributor
Posts: 246
Joined: Thu Dec 08, 2005 7:10 pm

Post by Gambler »

Were you joking? Or are you serious?
Joking.
I did no such thing, I am defending standards.
I shall smite infidels with righteous fury, for I stand for all things good and holy!
Excel is not a standard, it is a proprietary format
You imply that "standards" are a universally accepted value that must not be questioned. On top of that you imply that XML is more standard than other formats. This is not a real argument. Standards exist to enable seamless interaction between various parties. And in that sense XML is not more standard that Excel, FOX or ODB2.

Using XML for things it was never intended to do is common to the point of being absurd. I remember reading documentation for some Java program that said "we use short XML tag names like <i></i> to be efficient!". This is horrible. Almost as horrible as being asked to implement XML support in application that does not need any, "because XML is cool".
User avatar
cj5
Forum Commoner
Posts: 60
Joined: Tue Jan 17, 2006 3:38 pm
Location: Long Island, NY, USA

Some minor points

Post by cj5 »

The reason that we use XML instead of a specific application is that XML is not just a pretty face, living in isolation from the rest of the computing world. XML is more than a rulebook for generating custom markup languages. It is part of a family of technologies, which, working together, make your XML-based documents very useful indeed. To demonstrate what I mean, I decided to create a new XML-based markup language from scratch, and show what you can do with a document written in that language, using off-the-shelf tools. from: http://www.alistapart.com/articles/usingxml/
What have we bought by creating this XML file in a text editor rather than creating an HTML document or a spreadsheet or data base? First, the data is structured; it’s not just a mass of numbers in an HTML table or a text file of tab–separated values. Because of the custom tags, it’s something that humans can read and understand. It’s also open; we don’t need some expensive, proprietary software to extract the information from a binary file. So, as a transport medium, XML already serves us nicely. from: http://www.alistapart.com/articles/usingxml/
We believe the following principles to be central to making progress in this area:

1. There is no useful distinction between the representational needs of data and metadata. The kinds of information that need to be represented in metadata and data are very similar. Furthermore, every item of information, without exception, is likely to be regarded by some applications as ancillary and never to be displayed, and by others as core content that needs to be formatted, printed, or searched.
2. For interoperability and efficiency, schemata designed to serve different applications should share as much as possible in the way of data structures, syntax, and vocabulary. from: http://www.w3.org/TR/NOTE-MCF-XML/#sec1.1
XML allows developers to set standards defining the information that should appear in a document, and in what sequence. XML, in combination with other standards, makes it possible to define the content of a document separately from its formatting, making it easy to reuse that content in other applications or for other presentation environments. Most important, XML provides a basic syntax that can be used to share information between different kinds of computers, different applications, and different organizations without needing to pass through many layers of conversion. from: http://www.simonstl.com/articles/whyxml.htm
Still not convinced?
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

Gambler wrote:You imply that "standards" are a universally accepted value that must not be questioned.
Just the opposite. Standards are in fact industry consensus generated (not universal, but not bad), regularly updated (questioned!), and generally as a result, accepted.
Gambler wrote:On top of that you imply that XML is more standard than other formats. This is not a real argument.
It is a real argument regardless, but in this case, moreso because of the definition of standard. XML is definitely more widely accepted, implemented, and followed than Excel.
Gambler wrote:Standards exist to enable seamless interaction between various parties.
Correct.
Gambler wrote:And in that sense XML is not more standard that Excel, FOX or ODB2.
Incorrect.

Name the number of vendors that offer import and output to Excel (I don't mean CSV. I mean the full Excel format). (Here's a hint, its less than 10). Better, name *ONE* vendor that does so forward and backwards compatible. Can't. Even Microsoft cannot ensure the compatibility on a product that they control the specification for.

In contrast, XML is implemented by thousands of companies, and it has remained backwards compatible for several years - and future drafts promise to as well.

I'd say by any reasonable definition, thats more standard.
Gambler wrote:Using XML for things it was never intended to do is common to the point of being absurd. I remember reading documentation for some Java program that said "we use short XML tag names like <i></i> to be efficient!". This is horrible. Almost as horrible as being asked to implement XML support in application that does not need any, "because XML is cool".
On that much, we agree.
Gambler
Forum Contributor
Posts: 246
Joined: Thu Dec 08, 2005 7:10 pm

Post by Gambler »

Same thing over and over again.

Convinced? About what? I just said that given arguments are flawed.

Popularity does not indicate quality of a thing, neither does it show that a thing is more "standard." BTW, what's more "standard", 110, 220, 230 or 240 volts? Is one voltage better than all others? Another question. How many companies accept resumes written in XML with attached XSLT? Ok, how many companies accept resumes in ODT? This is not to say that DOC files are good, they are bloated, binary pices of crap. But a reference to common preferences (even held in some industry) doesn't prove or show that.
I decided to create a new XML-based markup language from scratch, and show what you can do with a document written in that language, using off-the-shelf tools.
Off-the-shelf tools are effects of popularity, not it's causes. http://sourceforge.net/search/?words=ex ... arch=softy
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

Gambler wrote:Same thing over and over again.

Convinced? About what? I just said that given arguments are flawed.
Quite the opposite, you continue to repeat only one argument - that popular != standard. Since you haven't offered a definition of standard (in fact, you continue to avoid doing so, so that you can argue that standard means nothing), you can't reasonably argue about what it means.

I've offered a definition, a substantial justification, and your response boils down to "Nuh uh". XML is more standard because more people use it. They work together on defining its attributes, they work together to change the standard, and they work together on implementing it.

None of those are true for proprietary document formats. Those are all reasons XML is MORE standard.
Gambler wrote:Popularity does not indicate quality of a thing, neither does it show that a thing is more "standard."
Two different arguments, and you are choosing to put them together to defend a weak position in the latter. Popularity can and does influence whether something is more standard - but you are correct, a discussion on standard has little influence on quality.

But in the case of XML, its high-quality as well - For its intended purpose. The purpose of XML is NOT efficiency of transfer. The purpose is consistent formatting. As a result, parsers are more reliable, easier to write, and inter-site communication is excellent.

You aren't contributing to the original poster's question. He wanted to know what the point of XML is. All you (continue) to do is argue why XML isn't (standard, high-quality). That does not define what XML is. It may put you in a position you enjoy (countering popular opinion), but that doesn't help the OP.

If you want to help, try offering a counter definition of what the point of XML is.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

- Can i easily get a hold of the data? Yes. Virtually every environment has a mechanism to handle XML.
- Can i transport all sorts of data efficiently? Not so sure about this.. Eg: binary data
- Does it solve my data-interchange problems? Not really, i still have to agree about a DTD/XSD before i can really give meaning to the data.. This is the same problem other datawrapping mechanisms suffer..

Like it or not, to me it seems that XML is simply a format to wrap your data in.. And provides you a way to easily interchange that data wrapped in XML...
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

You know what? This is a mute point. People should use the technologies available to them that best solves their problem. If XML works for you, great! Use it then. If it doesn't, theres probably another solution that will. I've never had to use it, so that is why I say I'm not impressed with it. If I ever DO need to use it, and it saves me a million headaches, then maybe my opinion will change.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

agtlewis wrote:People should use the technologies available to them that best solves their problem.
While mostly true, you're not the only one with a problem

The best way to solve my own problem might be to just dump out all my data in some weird hard to implement format, does that then ease the work of the developers trying to syndicate it? You shouldn't force possibly hundreds of other developers to learn a new technology when all it would take you is a small extra bit of effort to do it in a way that satisfies everyone's problem in the best way for everyone.

If XML works for you, great! Use it then. If it doesn't, theres probably another solution that will.
I think this is the lesson of this whole thread, I agree with it 100%
I've never had to use it, so that is why I say I'm not impressed with it. If I ever DO need to use it, and it saves me a million headaches, then maybe my opinion will change.
Your own loss, although as time goes on more and more people will start offering syndication in XML formats.. better start learning it soon
User avatar
cj5
Forum Commoner
Posts: 60
Joined: Tue Jan 17, 2006 3:38 pm
Location: Long Island, NY, USA

Post by cj5 »

agtlewis wrote:You know what? This is a mute point. People should use the technologies available to them that best solves their problem. If XML works for you, great! Use it then. If it doesn't, theres probably another solution that will. I've never had to use it, so that is why I say I'm not impressed with it. If I ever DO need to use it, and it saves me a million headaches, then maybe my opinion will change.
You're a waste of time and of human flesh! You got a 3 page forum going, and that's all you have to say. You need to respect the opinion of others, and stop being so blahsey. Who do you think you are! And the point is not silent, it is moot!

-- Learn from others or don't learn at all.
User avatar
AKA Panama Jack
Forum Regular
Posts: 878
Joined: Mon Nov 14, 2005 4:21 pm

Post by AKA Panama Jack »

cj5 wrote:
agtlewis wrote:You know what? This is a mute point. People should use the technologies available to them that best solves their problem. If XML works for you, great! Use it then. If it doesn't, theres probably another solution that will. I've never had to use it, so that is why I say I'm not impressed with it. If I ever DO need to use it, and it saves me a million headaches, then maybe my opinion will change.
You're a waste of time and of human flesh! You got a 3 page forum going, and that's all you have to say. You need to respect the opinion of others, and stop being so blahsey. Who do you think you are! And the point is not silent, it is moot!

-- Learn from others or don't learn at all.
No need to get personal.

For the most part agtlewis right. The main reasons for XML is to create portable data that is human readable. It's the human readable part that is the biggie. There are better and smaller formats for data exchange than XML. The only plus it really brings to the table is easily decipherable text data by someone looking at the output. An example would be comparing XML with Serialized variable data as they both can be easily transportable text data.

Original Data

Code: Select all

$array['stuff'] = "hi there";
XML

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<!DOCTYPE pXw4Pa SYSTEM "pXw4Pa.dtd">
<pXw4Pa version="0.8">
	<group>
		<entry name="stuff">hi there</entry>
	</group>
</pXw4Pa>
Serialize

Code: Select all

a:1:{s:5:"stuff";s:8:"hi there";}
The serialized data will be even more compact if even more data is included but the XML data is far easier to read and understand even though it will always be a much larger data file.

XML is good for transporting data between applications that normally do not work with each other and for limited usage.

XML is fairly poor when it comes to transporting large and complex data files because it is usually very slow when importing the data. The more complex the data import the worse XML becomes.

If you are creating your own applications and you do not need to export or import data from other applications then you shouldn't use XML but use something that is specific for your application.

Using XML is like using perfume. It is nice if you use a small dab but stinks up the place if you splash it all over. Use it only where it is needed and not for everything. It just creates unnecessary overhead and load. One of the worst uses for XML would be an XML data file that has to be loaded and parsed to get the configuration data for a web page every time it loads. Incredibly high overhead for what is needed.

Remember XML is not the end all, catch all for data usage in your PHP code.
Last edited by AKA Panama Jack on Sat Feb 25, 2006 8:58 pm, edited 2 times in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

keep it civil people.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

cj5 wrote:
agtlewis wrote:You know what? This is a mute point. People should use the technologies available to them that best solves their problem. If XML works for you, great! Use it then. If it doesn't, theres probably another solution that will. I've never had to use it, so that is why I say I'm not impressed with it. If I ever DO need to use it, and it saves me a million headaches, then maybe my opinion will change.
You're a waste of time and of human flesh! You got a 3 page forum going, and that's all you have to say. You need to respect the opinion of others, and stop being so blahsey. Who do you think you are! And the point is not silent, it is moot!

-- Learn from others or don't learn at all.
Hey...

That was totally uncalled for. I realize that my opinions may differ from the opinions of others. Sometimes I am right and sometimes I am wrong. But what you said was pretty dubious and I would encourage you to contemplate things more carefully before you reach such drastic conclusions. I honestly don't feel the need to defend myself from the statement you made, but I will anyway. All I was saying is that some people find XML very very usefull, and others have no need for it at all. Thats a pretty simple concept.

I do respect the opinions of others. I feel that perhaps you didn't respect my opinion when you wrote that post. I also feel that this is a great place to learn from others. I have learned more here than probably anywhere else on the Internet regarding PHP. I try to give back by helping others.

By the way, I didn't start this discussion, I only participated. Sorry I spelled "moot" incorrectly. I don't spellcheck everything I type.
Post Reply