What is the advantage of XML?

as any text file written in a unicode capable text editor :wink:

Have you ever worked with CORBA and it’s interface definition language ? When being able to describe complex data structures only by using echo, that’s what I call human readable.

Yes but the XML parsers keep in mind that probably, the parsed text is Unicode text :slight_smile:

in simple terms, xml is a human readable, standard, multi-platform, web based storage system.
XML is a web based storage system? A hard disk is a storage system, something physical that can carry data. Are you saying XML is a physical thing that can carry data?

One of the questions is about embeded schema information as opposed to external schema information. For example, a database has very little embeded schema.
If by schema you mean a description of the data (it’s attributes and it’s data types for example) and integrity constraints, then a database has very much embedded schema. The fact that SQL databases only support some constraints and data types is another matter.

When you fetch rows you get about the same information as delimited data gives you.
You get from the DBMS what you asked (queried) for. Would it be very strange to assume that if you specify what you want you also know what answer (or result set if you like) you can expect?

Data with embedded schema like XML excels in systems where the sender and recievers of the data do not want to maintain and syncronize common external schema.
So one party is sending the other data that is meaningful to itself but meaningless to the other party (meaning - no pun intended - that the other party does not onderstand that data)? No schema in the world is going to solve that problem.

I think the advantage of XML is that virtually every environment has tools to generate/parse XML


So instead of defining some (binary) format and writing the code to generate/parse it, you can use the allready available XML tools and spend your time on other parts of the code.
You are correct about the availability of tools is an advantage. However the same can be said for any storage format that has lots of tools available, be it a binary format or ‘human readable’. So that argument is not valid.

Exactly, the notion of using a bunch of XML files to store data for a CMS, is not what XML was meant for, and a poor approach to application design. XML was not meant to take away the job of a database. Yes it CAN be employed in this manner
 but just because you can doesn’t make it sensible to do so.

XML is not meant for data storage as much as a data exchange. It’s great in that regard. It is better than using comma delimited files or other ways to pass data, IMHO. XML files can take a data source, and present it in a meaningful way where the data is organized and descriptive for the recipient regardless of platform.

XML has it’s place, and it is definitely here to stay. But I would not use it for anything beyond what it’s meant for
 the transfer of data in a generic way that all other platforms can understand and use and parse. You don’t need to know or care who’s accessing the data and what their platform is. That’s why we have this standard, that’s pretty much the whole point.

As for the handling and storage of data within your own application, there are a few (but very few) reasons in my experience to employ XML to retrieve data and move it around. That is the job of your database. Someone mentioned (can’t remeber if it was this thread or another)
 the benefit of simply moving XML files should your app move to another platform. Well, if you have your database access layer properly abstracted from your business logic
 this is pretty much a non-issue.

To summarize
XML = a standard for data sharing and exchange regardless of platform.
Database = data storage and retrieval within your own apps. (still)

Um, then why did the author wrote the book? As far as ive read the sample chapters, he doesnt utilize databases at all? Or does he in the full book? The book seems to be a complete waste of time, if it uses XML to make a CMS when XML is not ment to be used like that


Because it’s a buzzword, and buzzwords tend to be used with different meanings by different people. I’ve had this discussion with a friend as well, and it comes down to what technology you prefer.

Using XML for storage is not unpopular, and I wouldn’t go so far as to say it’s not what xml was meant for. One area where it shines: Single-source publishing, for example DocBookXML. You write the document (or a complete book) once in one format, and then it can be easily and automatically translated into html4, xhtml, pdf, rtf, ps, wml, etc. etc. (at least in theory - most people fail in trying to get the proper environment together in the first place)

Of course that is neither unique nor brand new. There have alway been plenty of converters for (la)tex for example, but those were all applications that were written once and only for one purpose. With XML and the surrounding standards and tools, you write a document and it’s “specification” and then can let it be translated by whichever application in whichever language you want - as long as it supports the same standard. At least in theory.

Practically however, things are not nearly as easy as they are sometimes made out to be. I remember wanting to use XML for one application a few years back, and it turned out that a) my language of choice had sketchy xml support b) didn’t support Schema validation at all c) DTDs were way to weak to be useful d) there were no editors available that I would have wanted to put into user’s hands (most of which also had only the very basic xml-support - too little to be useful).

I find the XML concept intresting and it could be the next big thing

I had to laugh really hard, when i read that. Beause it alrady was the next big thing several years ago, only the promises that were made were (IMHO) never really fulfilled. But it looks a lot better today than a few years ago, it might actually be possible that we get there someday


What really p’d me off, was the fact that XML inspired so many Architecture Astronauts to build hideous things like the [url=http://www.tbray.org/ongoing/When/200x/2004/04/01/WS-Mumble]WS-* mumbo-jumbo. Or all the people that use XML-Files for configuration (in fact, I even did that myself back then, and I feel ashamed for it ;)). XML is just way too verbose for that.

Many places where XML is in use, you could do well without - it just introduced an unnecassary layer, as you can see in the many XML-RPC vs REST discussions (or not, depending on which side you’re on). This russian-doll type layering is humorously illustrated in The essence of XML.

Not sure what your gettin at, I don’t know why the author wrote the book, I’m actaully referring to the site point article of authoring an XML driven CMS. Sorry if I have the wrong thread here. My bad.

Does he utilize databases in his book, I couldn’t begin to tell you because I haven’t read it.

I would agree with that sentiment. XML’s main purpose is to share data in a “standard” way, regardless of platform, language or whatever. It was never meant to replace the role of a database, especially within an application where the data never leaves the application.

If data has to be shared across apps, or distributed out to other businesses then XML is a nifty solution.

Why one would bother with XML to build a fully self sufficient CMS is beyond me
 and perhaps I’m missing something here, I certainly don’t “know-it-all”.

XML would come into play if you wanted to syndicate your content to outside sources and had no clue how the reicpient would recieve that data.

Kinda like: http://www.sitepoint.com/syndication/

We should probably answer for the original poster some places where XML can be put to use with PHP. Here are a two reasons I have used XML:

  • XML is a good format to put data into that is going to be compiled into some run-time format that performs better. For example, you might want to have your template builders use XML because there are many tools out there to use for authoring. Then compile the XML templates into PHP. XML configuration data can me converted into PHP or serialized data to the quickly loaded. Etc.

  • XML is necessary when communicating with system that only have XML interfaces such as SOAP. You may not like XML and thinks SOAP sucks, but when your boss/client needs to connect to a vendor and that’s all they provide your opinion matters little.

As I posted on the first page, which seemed to be overlooked:

The Problem:

You have an Indian Language in a SQL database online. Not only do you need this online database search able, but you need to create a downloadable cdrom that is also able to search the database.

The Solution:

I dump specific text from the db to xml files, and use Flash to search the xml files on the cdrom. It’s actuall brilliant and requires nothing more than the flash file, and a directory containing the xml files.

Perfecto
 hehe

Perfect application of it.

This is exactly what XML was meant for. To serve as a text data container, provide a way to descript it, and to be valid.:slight_smile:

And BTW:
This is exactly what a database (i.e. MySQL) is meant for. To serve as a text data container. No description, no valid standard.

@Eric.Coleman: What is the advatage of XML in that case? I am not sure what that data looks like, but when you say language (as in dictionary), it seems those are simple key value pairs - nothing hierarchical that would justify the use of xml. But maybe I just misunderstood the task you were trying to solve.

R.U. Serious:

This is a Lenape Indiain Language, the kind of data involved are parts of speach (verb, noun, etc) sounds files, images, IPA information, as well as keywords. The english and lenape version of the text.

Could you propose a better method of searching and mainting the data outside of MySQL for a Flash based CD-Rom?

So I did have a wrong understanding of the data involved. Under those circumstances XML seems an adequate solution to me.

This is exactly what a database (i.e. MySQL) is meant for. To serve as a text data container.
Hehe :slight_smile: Get yourself a proper education on databases. A database is so much more than that. The problem is not only that you don’t know what a database is but also that you do not know that you should know it.

If you knew what a database really is you would also able to see why XML is not a good replacement.

  • Actually, it’s pretty easy to represent each XML file structure in a Relational Model.
    The only problem is with SQL, you need to use an approach like NestedSets to query it.

  • Although the structure is human-readable, the complete XML content isn’t always (and binary XML isn’t going to improve that). An example:


<Picture>
    <![CDATA[qĂĂĂˆĂĂ«?ÞñÒïïTÕÿ£]]>
 </Picture>

What is the problem with SQL ? I didn’t get that. Are you saying XML can’t be queried like a normal relational database ? If so, take a look here: http://www.w3schools.com/xquery/default.asp

The example is as invalid as it gets. I worked with XML a lot and I never saw the need to include binary data in XML as you just showed it’s posible. Also, please take a look here: http://www.w3schools.com/svg/default.asp

I would say the advantage of XML is within your own hands, you could build up any structure you like with XML, XML however these days is a broad concept of many interactions between leaf protocolls like Xslt, DTD, XPath, Xquery, SOAP, DOM, SAX, WSDL, and many more to go, these protocolls all have their own purpose within and with or in combination with well formed XML or XHTML pages.

The 3rd Edition of Beginning XML from Wrox has 995 Pages that all have something to do with XML, so i dont think your question is right, it’s not relevant, the important thing is can XML solve your problem, and how can it solve your problerm, and in what ways can i solve , and therefore i definatly say go and dive into the world of XML if that is what your asking but else you would have to state your problem


Btw, Proton, nice subline

I once had a problem.
I thought: “Oh, I know: I’ll just use XML!”
Now I had two problems.

Bwahahaha,
lol, but it’s true :agree:

cheers,
Galo

No, i was saying that modelling a tree in a SQL database isn’t straightforwarded, not if you want to query it efficiently. And thus i referred to a possible solution like NestedSets.

An example is not invalid because you have never seen the need for it.

Ohh, sorry. Now I get it. Well, this is one reason people feel the need for object oriented databases sometimes.

There is a difference between what a technology can do, and what it should do. Just because it can embed binary data, doesn’t mean you should do it. Also, for example in RSS, you don’t pass the binary data that forms a picture, you just keep the picture somewhere and pass the URL :cool:. And this is the normal approach for passing binary data around in XML.

Looks like the proper education on databases is your weak side :wink: And with XML there are two weak sides of you :rofl: . And two problems :stuck_out_tongue:

I’ve never said XML is meant to be a replacement for a database. But it can be used like one.

Check the following links:
http://www.xml.com/pub/a/2001/10/31/nativexmldb.html

http://www.sleepycat.com/products/xml.shtml

http://www.25hoursaday.com/StoringAndQueryingXML.html

As was mentioned in the introduction, there is a dichotomy in how XML is used in industry. On one hand there is the document-centric model of XML where XML is typically used as a means to creating semi-structured documents with irregular content that are meant for human consumption. An example of document-centric usage of XML is XHTML which is the XML based successor to HTML.

The other primary usage of XML is in a data-centric model. In a data-centric model, XML is used as a storage or interchange format for data that is structured, appears in a regular order and is most likely to be machine processed instead of read by a human.