Attributes vs. text content (Was Re: RFC: Attributes and XML-RPC)

Jeff Greif jmg at trivida.com
Tue Sep 21 20:07:16 BST 1999


For certain kinds of applications, I find the opposite style -- attributes
only and no PCDATA -- works best.  One such use of XML was to organize a
configuration file for a call-center simulator.  This plays back records of
call-center activity through a learning engine which rapidly figures out how
to predict with decent accuracy what the current (support or sales) call is
going to be about, and what the same person will probably call in with in
the future.  The simulator's purpose was to enable the computation of how
many calls could be avoided or shortened by proactive behavior on the part
of the support agent when the call came in.

The XML file contained information about where to get the data, how it was
mapped into the learning engine, and where the database for output
information was found, as well as certain parameters that governed the
behavior of the simulator, such as how much feedback the agents would get
about whether the predictions were right.  The DTD for this XML file
specified a raft of elements and attributes, but no PCDATA.  It was
extremely convenient to be able to easily denote which attributes needed to
be present, to provide default values, insist on values from an enumerated
set (thus avoiding misspellings).  We used a validating parser (IBM's), and
sucked the configuration out of the DOM into application-specific data
structures.  The parser threw out invalid configuration information that
would have complicated the code significantly to detect, and supplied the
various default values.  Basically, the configuration-reading code needed no
error-handling beyond passing on any complaints from the XML parser.
Erroneous information could still be provided that would cause the database
queries to fail, but database failure had to be handled anyway.

The users would come to me with almost any kind of problem, including
forgetting to start the learning server, but after I gave them one simple
and one more complex sample configuration file to cut and paste from, they
were able to download a database of calls in random format from some
prospective customer, and prepare a configuration file that worked after a
few iterations (usually not involving me).  The configuration reading code
essentially worked the first time and needed few changes as the system
evolved.  Structuring with only elements and attributes and using a
validating parser were important factors in this.

Anyone interested in the DTD or a sample config file can look at
http://www1.trivida.com/public/greif/CallAvoidanceConfig.dtd   and
http://www1.trivida.com/public/greif/BlahBlahSmallConfig.xml

Jeff

----- Original Message -----
From: Tim Bray <tbray at textuality.com>
To: <xml-dev at ic.ac.uk>
Sent: Tuesday, September 21, 1999 9:08 AM
Subject: Re: RFC: Attributes and XML-RPC
...
> There's a repeating pattern here.  When I first discovered SGML (in
> 1987) I quickly decided that attributes were an unnecessary and
superfluous
> redundancy...
>
> I've noticed this pattern in others besides myself and Dave.  People who
> come to generic markup with a lot of experience in technology don't see
> why you need two different syntaxes for labeling information.
>
> Years later, I got used to it.  From the programmer's point of view,
there's
> no difference in the degree-of-difficulty of extracting info from elements
> and attributes


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list