[sf-perl] Some well-formed XML?
doom at kzsu.stanford.edu
Tue Sep 20 13:22:33 PDT 2005
Rich Morin <rdm at cfcl.com> wrote:
> So, it's fairly straightforward to serialize a set of RDBMS
> tables as XML and load them back into another database. The
> rules for the (de-)serialization, however, will probably be
> hard-coded into your dumping and loading code.
Funny, I was just in the process of doing just this sort of thing.
In particular I'm noodling around how to preserve NULLs.
NULLs can be mapped to undefs in perl, which usually get mapped to
empty strings when written to some text format, but then that leaves
you with no way to distinguish between those and fields that started
out as empty (but non-NULL) VARCHARs.
So, you hack in code to translate the NULL/undefs to a string "NULL"?
Perhaps with additional hackery to preserve any odd ball strings
containing "NULL" to start with?
This is one of those things that I know has been solved a million
times, but I doubt I'm going to want to bug Ops to install some CPAN
modules to do it.
(By the way, has anyone noticed that XML::Simple can't always read
in the files that it writes? Fun.)
More information about the SanFrancisco-pm