Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks,
This (long-ish) question is mainly about design. I have a simple "database". Basically it is only one table, with about 30 fields and a few hundred records. I would like to extract this data and post to the web via CGI.
One limitation of the server I am using is that I cannot install a real database -- I am stuck with plain-text. That shouldn't be a problem. Parsing this file on a per-request basis will be easy, especially given the low-traffic nature of the site.
What is the problem? Two things, actually. Let me specify first that I am now, and likely will be always be the only maintainer for this site. I set both the file-format and the CGI parsing code. Now, my two concerns:
I had initially thought that XML was the solution, but I have run into problems with both of the above points (I'm not posting code because I want to acertain if I should stick with XML or instead try something else).
Basically, my problems thus far have been: XML is slow, XML introduced bloat, as best as I could see I needed to escape everything to insert it into the XML, and I have *no* desire to start entering records using &xx; format for all my /\"'& and whatever other characters.
So, I am looking for suggestions on how to proceed. Am I struggling with the XML approach because I'm a novice with it, or choosing poor tools (XML::Parser and XML::Writer)? I have a lot of DBI, so I was surprised at having to handle my own escaping. Are there other ways around this?
One final thing: my current alternative is just a text-file with each line containing the field-name followed by value, and a record delimiter like '-' x 50, e.g.:
Field1: DATA Field2: MOREDATA #other fields# ------------------------------- Field1: DATA Field2: MOREDATA #other fields#
This wouldn't allow easy stream-based parsing (e.g. no while (my @row = $dbh->fetchrow_array()) nice-ness), but otherwise seems refreshingly simple compared to XML. Any comments on that?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML "Database" --> HTML
by sri (Vicar) on Aug 31, 2003 at 02:02 UTC | |
|
•Re: XML "Database" --> HTML
by merlyn (Sage) on Aug 31, 2003 at 12:13 UTC | |
|
Re: XML "Database" --> HTML
by allolex (Curate) on Aug 31, 2003 at 06:57 UTC | |
|
Re: XML "Database" --> HTML
by Hutta (Scribe) on Aug 31, 2003 at 03:46 UTC | |
|
Re: XML "Database" --> HTML
by TomDLux (Vicar) on Aug 31, 2003 at 02:24 UTC | |
|
Re: XML "Database" --> HTML
by CombatSquirrel (Hermit) on Aug 31, 2003 at 01:43 UTC | |
|
Re: XML "Database" --> HTML
by drfrog (Deacon) on Sep 01, 2003 at 00:27 UTC | |
|
Re: XML "Database" --> HTML
by Cody Pendant (Prior) on Sep 01, 2003 at 04:08 UTC |