Re: Glib::KeyFile bug?

On Mon, 23 Jun 2008 09:14:39 -0400 Damon Register wrote:
> All of the xml examples I found just read the entire file and print
> the results.  Do the xml methods not really support the random
> access as does the Glib::KeyFile::get_string ?

Part of the problem is that XML is not a file format, but a
meta-format. The Windows ini-file / Gtk Keyfile are real formats,
designed to contain information of a given structure, even if the key
names are arbitrary. XML doesn't even define a structure for your data,
but merely a (rather inconvenient and ugly) syntax for representing

If you want to do random access of "XML" data, you first need to define
what the structure of that data really is, then define some suitable
equivalent representation in your language of choice. *Then* you stand
some hope of writing an XML parser that reads the file in to somewhere
you can access its contents.

That said, I believe I've seen a generic XML parser for Python (and
probably for Perl). This is possible because Python provides the
"dictionary" type, which is a fairly arbitrary data meta-type and can
therefore capture the unspecified structure of your XML data. Of
course, you still need to define what it means before the dictionary is
meaningful :)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]