[Classiccity-pm] XML is too hard for programmers

Jonathan Daugherty cygnus at cprogrammer.org
Mon Feb 16 10:02:56 CST 2004


# Saw this posted elsewhere and it pretty much sums up my thoughts on
# the subject.  I wondered if you guys have found XML nirvanna and care
# to share it with the rest of us..
# 
# http://www.tbray.org/ongoing/When/200x/2003/03/16/XML-Prog

A good read.  On occasion I get the bright idea to use XML as a basis
for a config file or something.  When I do, the first step is always
deciding which parsing model to use -- event-driven or DOM-style --
and rarely does one or the other fit very well with the design of my
program, chiefly because:

1) Event-driven parsing requires the implementation of a small handful
   of handlers for various parsing events, all of which will hopefully
   operate on some data structure.  This is usually trivial, but
   depending on the implementation language this may be a really bad
   design choice.

2) DOM-style parsing generally results in a really nasty, difficult-to-
   use data structure.  This is true for some APIs in Perl, Python, C,
   and C++.  QT has what I think is the nicest C++ API, and some of
   the python modules are nice, too.  The dom-style xml stuff I've done
   in perl always leaves me with an uneasy feeling.  I always have to
   use Data::Dumper to figure out what the fuck is going on.

One of the things about xml work that annoys me is that there are
tons of different APIs for doing it, and most of them differ only by
small degree.  And some of them just make things more kludgy, like
adding a new class or set of functions to operate on nodes in an
XML tree, etc.  On many occasions I have simply decided that using
XML wasn't worth the effort, and I've gone with an X resource file or
something similar.

So I guess I don't have anything new to offer -- I'm just complaining
since the article reminded me how much of a love-hate relationship I
have with XML.

-- 

  Jonathan Daugherty
  http://www.cprogrammer.org

  "It's a book about a Spanish guy called Manual, you should read it."
                                                            -- Dilbert



More information about the Classiccity-pm mailing list