I am still in the design on paper phase and this technique is not concrete. I would be interested to hear about other ways I might be able to do this with a minimum amount of pain.

Justin Akehurst said on November 01, 2004

I'm curious... could you post the resource that you mentioned above that had this idea in it?

Jonathan Snook said on November 01, 2004

To be honest, Justin, I'm not sure where I came across the idea initially. But I wanted to be clear that I wasn't being original when I presented the concept. I did a search on Google using keywords like: "unstructured data", "flexible structure", which led to terms such as "storing and retrieving xml" along with the different DBMSs. I went through about 100 sites and a number of discussions on Google Groups.

Justin Greer said on November 03, 2004

I've been using this same concept in a slightly different manner. I have a bunch of articles that share a database, but many of the articles have different content (one might be a photo album, another is a simple announcement, another is a job posting, etc.) Most of the data used for presenting 'em in a website is consistent -- date, type, title, "blurb," etc. So that all goes in database fields. Then I have a big ol' text field in the database where I've chosen to store a string of PHP-serialized data rather than XML. (Significantly less processing, more integrateable with the language, but less portable.)

It's been working *very* well, allowing rapid development of new article/content types to fit into our content management system without rewriting any existing code (just the input/output handlers for the article types). I didn't have a source for the concept; it just made sense to do it that way. (However, I very likely read something about it years ago and so had the concept in my mind somewhere already.)

MarkBu said on November 04, 2004

OK so this may be really left field, but. Could the database, be just one XML field (still in a database for speed and search, but optionally filebased) and have the whole templating, delivery mechanism with XSLT.

Second mad idea. What about having the whole site's data available via a RSS link so that you could get mirror and backup for the cost of a small tool.

I guess you can tell I am new to this, but then maybe one day an idea will be of value (grin).

Yours in admiration that you are designing this in public.

Chris said on May 23, 2005

Good idea, this XML lark. I'm writing a CMS and am using XML to store flat file cached backups of each page, from which the viewable page is created, but your solution would mean much less proessing to get the data into that format to start with.

I'm not sure what the tradeoffs would be in terms of searching (if someone searched for "XML" would they get every item?) but it's certainly a very interesting way of thinking about things.

Jonathan Snook said on May 23, 2005

One of the possibilities that I thought of to circumvent the search issue is to build a related table that only stores a key to the objects table and a filtered version of the content for filtering. Any searches would be done on the indexed table with the results joined to the objects table to pull out the content for display.

The filtering could remove unnecessary words, xml/html tags, and provide any other filtering that might help improve search results.

VIshal Jain said on February 15, 2007

I want to know how can we insert record in XML file using web application PHP HTML etc.

Sorry, comments are closed for this post. If you have any further questions or comments, feel free to send them to me directly.