Forum Moderators: open
I've known about XML for a fairly long time but I never found the opportunity to actually implement it. Well - actually there was one application a little while back I wrote which I should have used it for... but that's another matter.
Anways, I'm curious about how you all use pure XML (not XHTML or anything like that). I know its good for things like databinding to html elements - but are there databases that will directly give you xml? Can you databind straight to a database? Or do you have to use server-side programming to create the XML from the database?
I'd love an opportunity to use it (I hate having programming books that I don't use) but I am having trouble finding a good opportunity for it. Admittedly - database work is one of my weaker attributes as a web designer (hopefully this will change once I take some classes at my college).
Ryan
Sending back a success response or a item number as an XML statement is absolute overkill - direct text is almost certainly a better option.
Yeah, it's bloaty, but you pay a price for a common exchange format with built-in parsers in every language on Earth. Go ahead and write your own, but you'll need to write and test your own parser. Have fun. You can use JSON, but that's just as bloaty, and quite awkward.
BTW: I'm in the process of developing a new Web service that will send XML to clients. I've decided that the XML will be in the form of XHTML. This is a bit wordier than writing custom XML, but has the significant advantage of being able to be placed directly into a Web page with no parsing.
are there databases that will directly give you xml?
Yes -- Microsoft SQL Server can deliver XML right out of a SQL command. Do a search for "SQL FOR XML"; all the SQL queries end with "FOR XML something". It can also do fast paced searches for XML stored in databases.
MySQL 5.1 has XML features built in too
It's less efficient than binary forms, as far as data content and data size.
However, it comes with an enormous arsenal of tools and language support. It affords incredible flexibility and stability.
In many cases, how long it takes you write something, test it and support it need to be factored into the calculation.
For example: If it takes you five minutes to write a routine that parses XML, even if the XML will be transported locally, and you don't worry about testing, and it takes you two days to develop a binary transfer API, and another two days to test it; all for transfers of 64 bytes of data, then which do you think is more efficient?
I'm considering going back and changing it. But I may just wait until Version 2 of the program - I'm not sure yet as the program isn't complete yet. I've been too lazy to work on it though - its a personal side project.