Ballots in Yaml and XML

From Trust The Vote

Jump to: navigation, search

Sample Data Format

The notation below is for illustration only and to compare XML with YAML. YAML is an easier to read and understand analog to XML. XML and YAML can be freely translated between each other (more or less.)

Below is the same (fake sample) data format shown first as YAML and then as XML. Compare.

YAML

 ballot:
   dpi: 150
   name: 123.tiff
   width: 1280
   height: 640
   precinct: 2391
   contest:
     - name: presidential
       max_allowed: 1
       rect: [23, 100, 55, 400]
       active: yes
       choice:
         - name: John Smith
           target-type: oval
           target-coords: [23, 100]
           target-size: [20, 20]
         - name: John X Smith
           target-type: oval
           target-coords: [23, 100]
           target-size: [201, 20]
     - name: dog catcher
       max_allowed: 1
       rect: [23, 100, 55, 400]
       active: yes
       choice:
         - name: John Smith
           target-type: oval
           target-coords: [23, 100]
           target-size: [20, 20]
         - name: John X Smith
           target-type: oval
           target-coords: [23, 100]
           target-size: [201, 20]

XML

 <ballot precinct="2391" name="123.tiff" height="640" dpi="150" width="1280">
   <contest name="presidential" max_allowed="1" active="true">
     <choice target-type="oval" name="John Smith">
       <target-size>20</target-size>
       <target-size>20</target-size>
       <target-coords>23</target-coords>
       <target-coords>100</target-coords>
     </choice>
     <choice target-type="oval" name="John X Smith">
       <target-size>201</target-size>
       <target-size>20</target-size>
       <target-coords>23</target-coords>
       <target-coords>100</target-coords>
     </choice>
     <rect>23</rect>
     <rect>100</rect>
     <rect>55</rect>
     <rect>400</rect>
   </contest>
   <contest name="dog catcher" max_allowed="1" active="true">
     <choice target-type="oval" name="John Smith">
       <target-size>20</target-size>
       <target-size>20</target-size>
       <target-coords>23</target-coords>
       <target-coords>100</target-coords>
     </choice>
     <choice target-type="oval" name="John X Smith">
       <target-size>201</target-size>
       <target-size>20</target-size>
       <target-coords>23</target-coords>
       <target-coords>100</target-coords>
     </choice>
     <rect>23</rect>
     <rect>100</rect>
     <rect>55</rect>
     <rect>400</rect>
   </contest>
 </ballot>
Personal tools