Thread: Storing HTML in table
Hi: I need to store markup in a database to control how the browser renders the page information. I would like complete control over this information -- so if sometime in the future it's decided to totally redesign the layout. Also, at some point a tool will be created so novice computer users can enter nicely formatted markup -- meaning you won't have to know HTML to use this tool. In it's raw form, data will be stored like this: <p>some header goes here</p> <p><img src='foo.gif'></p> <p>more text here</p> A few ideas are to:* Use css Store the data like: <span class='text_stuff'>text here</span> <span class='img_stuff'><imgsrc=...></span> * Store in XML and XSLT * Don't use HTML -- but something that will parse keys into HTML. E.G. [:bold] or [:img] But what happens if you have a single item that's [:bold], <span class="text-bold"> or etc. and need to take away the bold and change the font size? It just seem that there is an easy way of doing this that I'm not thinking of. Does anyone recommend a certain way for storing HTML in a table? Thanks,
Rob <isanamespace@yahoo.com> writes: > I would like complete control over this information -- so if sometime in the > future it's decided to totally redesign the layout. Also, at some point a > tool will be created so novice computer users can enter nicely formatted > markup -- meaning you won't have to know HTML to use this tool. You should go look at some of the XML database books out there and maybe you'll find a tool to do what you want. But beware, there's a lot of snake-oil in this field. Anyone who promises a one-size-fits-all solution to every problem is probably deluded. The problem is hard. There's an inherent tension between being able to easily manipulate parts of the data and flexibility in the type of data you can represent. One one side is the traditional relational database model where every record must contain precisely the same fixed list of predetermined columns. One the other side is the decidely non-relational model where you just store a large hunk of xml text. What you're looking for is one of the many systems that attempt to bridge these two extremes and provide the best of both worlds. -- greg