[EM] Why is XML perfect?

Narins, Josh josh.narins at lehman.com
Mon Sep 30 07:48:11 PDT 2002


Oh, why?

Sharing data.

I don't care if you write assembler(ha!) or visual basic(haha!), or if you
count Condorcet or approval, this representation of the data will be
acceptable input to anything.

FYI, the most standards compliant fast way to parse XML data is called SAX.
SAX2 adds support for namespaces (which we should use, but can generally be
ignored) and other features.

I write SAX parsers all the time.

For fun.

-----Original Message-----
From: Narins, Josh 
Sent: Monday, September 30, 2002 9:33 AM
To: 'election-methods-list at eskimo.com'
Subject: [EM] Why is XML perfect?


XML can represent all data.
XML is still on version 1.0 (name another widely used computer specification
that is!)
Humans and computer can read much XML.
All major computer languages have XML support, even XMLNS (XML with
NameSpaces)
Here is a _well-formed_ (1) and _0valid (2) XML document for voting.

I wrote F{64} to represent a 64 character hex string.  FF represents a two
character hex string.

Comments?

-Josh Narins

(1) That's easy. There are only 5 or 6 rules. You can't have a & or a <, you
have to write them & and <.  You also have limited use of " ' and >
(" ' and >)  I leave the rest as an exercise for the reader.

(2) all the DOCTYPE stuff in the second example sets out a set of rules for
the data

<?xml version="1.0"?>
<v:vote id="F{64}" xmlns:v="http://x.narins.net/mlns/vote.dtd">
 <time value="2002091120:10:05" />
 <location value="F{64}" />
 <crew supervisor="F{128}"  machine="F{128}:F{128}:F{128}" sub="F{128}" />
 <race id="FF">
  <candidate id="FF" rank="FF" />
  <candidate id="FF" rank="FF" />
  <candidate id="FF" rank="FF" />
  <candidate id="FF" rank="FF" />
 </race>
 <issue id="FF">
  <option id="FF" rank="FF" />
  <option id="FF" rank="FF" />
  <option id="FF" rank="FF" />
  <option id="FF" rank="FF" />
 </issue>
</v:vote>

THIS VERSION INCLUDES ITS OWN DTD, that makes it more correct.

<?xml version="1.0" standalone="yes"?>
<!DOCTYPE vote [
 <!ELEMENT vote      (time,location,crew,(race|issue)*)>
 <!ATTLIST vote      xmlns:v    CDATA   #FIXED
"http://x.narins.net/mnlns/vote.dtd">
 <!ELEMENT time      EMPTY>
 <!ATTLIST time      value      NMTOKEN #REQUIRED>
 <!ELEMENT location  EMPTY>
 <!ATTLIST location  value      NMTOKEN #REQUIRED>
 <!ELEMENT crew      EMPTY>
 <!ATTLIST crew      supervisor NMTOKEN #REQUIRED
                     machine    NMTOKEN #REQUIRED
                     sub        NMTOKEN #IMPLIED>
 <!ELEMENT race      (candidate+)>
 <!ATTLIST race      id         NMTOKEN #REQUIRED>
 <!ELEMENT candidate EMPTY>
 <!ATTLIST candidate id         NMTOKEN #REQUIRED
                     rank       NMTOKEN #IMPLIED>
 <!ELEMENT issue     (option+)>
 <!ATTLIST issue     id         NMTOKEN #REQUIRED>\
 <!ELEMENT option    EMPTY>
 <!ATTLIST option    id         NMTOKEN #REQUIRED
                     rank       NMTOKEN #IMPLIED>
]>
<v:vote xmlns:v="http://x.narins.net/mlns/vote.dtd">
 <time value="2002091120:10:05" />
 <location value="F{64}" />
 <crew supervisor="F{128}" 
       machine="F{128}:F{128}:F{128}"
       sub="F{128}" />
 <race id="FF">
  <candidate id="FF" rank="FF" />
  <candidate id="FF" rank="FF" />
  <candidate id="FF" rank="FF" />
  <candidate id="FF" rank="FF" />
 </race>
 <issue id="FF">
  <option id="FF" rank="FF" />
  <option id="FF" rank="FF" />
  <option id="FF" rank="FF" />
  <option id="FF" rank="FF" />
 </issue>
</v:vote>


----------------------------------------------------------------------------
--
This message is intended only for the personal and confidential use of the
designated recipient(s) named above.  If you are not the intended recipient
of this message you are hereby notified that any review, dissemination,
distribution or copying of this message is strictly prohibited.  This
communication is for information purposes only and should not be regarded as
an offer to sell or as a solicitation of an offer to buy any financial
product, an official confirmation of any transaction, or as an official
statement of Lehman Brothers.  Email transmission cannot be guaranteed to be
secure or error-free.  Therefore, we do not represent that this information
is complete or accurate and it should not be relied upon as such.  All
information is subject to change without notice.


----
For more information about this list (subscribe, unsubscribe, FAQ, etc), 
please see http://www.eskimo.com/~robla/em


----------------------------------------------------------------------------
--
This message is intended only for the personal and confidential use of the
designated recipient(s) named above.  If you are not the intended recipient
of this message you are hereby notified that any review, dissemination,
distribution or copying of this message is strictly prohibited.  This
communication is for information purposes only and should not be regarded as
an offer to sell or as a solicitation of an offer to buy any financial
product, an official confirmation of any transaction, or as an official
statement of Lehman Brothers.  Email transmission cannot be guaranteed to be
secure or error-free.  Therefore, we do not represent that this information
is complete or accurate and it should not be relied upon as such.  All
information is subject to change without notice.


------------------------------------------------------------------------------
This message is intended only for the personal and confidential use of the designated recipient(s) named above.  If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited.  This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers.  Email transmission cannot be guaranteed to be secure or error-free.  Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such.  All information is subject to change without notice.


----
For more information about this list (subscribe, unsubscribe, FAQ, etc), 
please see http://www.eskimo.com/~robla/em



More information about the Election-Methods mailing list