RE: [PHP] PHP and XML?

From: Date: Thu, 31 Aug 2000 00:23:06 +0000
Subject: RE: [PHP] PHP and XML?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-14485@lists.php.net to get a copy of this message
HI James, Simon and others The idea for this discussion is NOT to flame anyone, I know this is a digression already from PHP, but I need to know the "big deal" about XML because PHP is touted as being weak in that area. So I'll calmly wade through your points. | Actually, a purchase order is a good example of where XML is much better | than a CSV or flat file. How do you show the information about a | customer and then 'n' number of products that they want to purchase? Why not? First, lets say the delimiter is "{|}" and not a comma, or any other character that I am SURE doesnt occur in my data. Then I define two flat files. One looks like this: C U S T O M E R . D A T shanx {|} Shashank {|} Tripathi {|} Hong Kong sedwards {|} Simon {|} Edwards {|} Down-under ... O R D E R S . D A T shanx {|} Order 1 shanx {|} Order 2 sedwards {|} Order 1 ... etc. Cant my application take care of the data then? | XML is suited to representing info that can be placed in a tree, with CSV | only really useful for table based data. (i.e. data that can be placed | in a table.) This is getting interesting. Why? Isnt the above information representable in a tree? | Then you've also got the problems with CSV like how do you represent | different character sets, how do you represent a comma value in CSV. XML | provides uniform solutions to these problems. Character sets are BARELY the problem! The delimiter I showed you above NEVER appears in CHinese (2 different charsets), Japanese, Vietnamese, Malay, Thai and Korean. And by that I mean that being in Asia, I have worked on projects that involve different languages, and we have flat files for error messages on the website to centralise the error-display functionality. Since I dont always have Chinese capable OS, these flat files for the other languages LOOK like junk in my Notepad. Charset is THE LAST PROBLEM I would think of. XML is also ultimately information stored in text files isnt it?? | As for complexity, XML parsers shield application programmers from | having to directly deal with the XML syntax. We can do the same with the delimited files as well, no? Cant I write a simple VB app, or even a web-based PHP app to read/add/modify info in the right places? As for adding information to the DTD being convenient, yes you can add it to the DTD. But then you have to update the actual data isnt it -- for it to be convenient, you would most likely do it with a script or a program? But in that case I find it hard to see any difference in updating a simple delimited file through a script as well! If dealt with sensibly, even a delimited file is VERY useful! | I strongly recommend buying a good book on XML and reading it from start | to finish. I can recommend "XML by Example" from QUE. I have the WROX book, and thats much more respectable than the "XML by E" (in my humble opinion). But most of these books do not add anything to my plate that I already cannot find on the net. | XML and most of it is not obvious if you just give it a quick glance. I | was surprised. Would you like to share WHAT surprised you? You *might* be surprised if you spend sometime thinking about delimited files as well. Will look forward to your comments/experiences..thanks! I am not being cynical, just playing the devil's advocate here. Cheers Shanx -- Shashank Tripathi www.shanx.com

« previous php.general (#14485) next »