Jump to content

First-past-the-post and PR Top-up XML

This document describes XML messages that are used for election events that use the first-past-the-post (FPTP) or proportion representation (PR) voting systems. These tend to be parliamentary and assembly elections. Sometimes a mainly FPTP election will also have a number of PR Top-up seats, in which case that type of XML will used for those seats.

Message types available

For UK General Elections, Scottish Parliament, London Assembly, Welsh Assembly and European elections, the following types of data are available in XML:

  • Nominations (FPTP or Top-up)
  • Rushes (FPTP or Top-up)
  • Results (FPTP or Top-up)
  • Recount notifications
  • State of parties, including forecasts

All message types are specified by a set of W3C schema files, downloadable from here.

Voting areas participating in these types of election may be using the first-past-the-post (FPTP) or proportional representation top-up voting systems. There are message types for each of these systems.

Nominations

To prepare your systems for elections, first use the nominations files first from our server. There is a nominations file for each constituency, giving the details of the constituency and all the candidates standing for election there. The file may be of the FPTP or Top-up variety, depending on the system voting system in use

Nominations files follow the following format for both FPTP and Top-up messages:

{Election name}_nominations_{Constituency name}_{Revision}.xml

Each nominations message has a revision number, which is present in both the filename and the message itself. Whenever nominations for a constituency are updated, a new message with a higher revision number will be made available on the server. Note that a higher revision number does not necessarily mean that the nominations have actually changed, however.

Occasionally corrections to nominations come to light only during the results operation, where suddenly we learn that there is an extra candidate, or that one has dropped out, or that a name was incorrect. In such a case, a revised nominations file for the affected constituency will automatically be made available, before the results.

The nominations for a FPTP constituency are provided in a message with an FirstPastThePostNominations root element, adhering to the FirstPastThePostNominations.xsd

Here is an example of a FPTP nominations message from the 2015 General Election, with the filename General_Election_nominations_Aberavon_1.xml:

<?xml version="1.0" encoding="UTF-8"?>
<FirstPastThePostNominations revision="1">
  <Election name="General Election" date="2015-05-07" type="G">
    <Constituency number="627" name="Witney" electorate="79767">
      <Candidate paId="59925" previousSittingMember="*" sex="M" firstName="David" surname="Cameron">
        <Party paId="5371" name="Conservative" abbreviation="C" />
      </Candidate>
      <Candidate paId="98884" sex="M" firstName="Duncan" surname="Enright">
        <Party paId="5372" name="Labour" abbreviation="Lab" />
      </Candidate>
      <Candidate paId="112731" sex="M" firstName="Andrew" surname="Graham">
        <Party paId="5374" name="Liberal Democrat" abbreviation="LD" />
      </Candidate>
      <Candidate paId="113805" sex="M" firstName="Stuart" surname="Macdonald">
        <Party paId="5377" name="Green" abbreviation="Green" />
      </Candidate>
      <Candidate paId="98996" sex="M" firstName="Simon" surname="Strutt">
        <Party paId="5506" name="UK Independence Party" abbreviation="UKIP" />
      </Candidate>
      <Candidate paId="115517" sex="M" firstName="Bobby" surname="Smith">
        <Party paId="7890" name="Vote Elmo" abbreviation="Elmo" />
      </Candidate>
      <Candidate paId="115510" sex="M" firstName="Chris" surname="Tompson">
        <Party paId="5427" name="Independent" abbreviation="Ind" />
      </Candidate>
      <Candidate paId="115514" sex="M" firstName="Deek" surname="Jackson">
        <Party paId="7888" name="Land Party" abbreviation="LP" />
      </Candidate>
      <Candidate paId="115578" sex="M" firstName="Nathan" surname="Handley">
        <Party paId="5467" name="No description" abbreviation="ND" />
      </Candidate>
      <Candidate paId="115515" sex="M" firstName="Clive" surname="Peedell">
        <Party paId="7843" name="National Health Action Party" abbreviation="NHAP" />
      </Candidate>
      <Candidate paId="115516" sex="F" firstName="Vivien" surname="Saunders">
        <Party paId="7889" name="Reduce VAT In Sport" abbreviation="VAT" />
      </Candidate>
      <Candidate paId="115512" sex="M" firstName="Colin" surname="Bex">
        <Party paId="5510" name="Wessex Regionalist" abbreviation="Wessex Reg" />
      </Candidate>
    </Constituency>
  </Election>
  <PreviousElection name="General Election" date="2010-05-06" type="G">
    <Constituency number="627" name="Witney" turnout="57769" percentageTurnout="73.34" winningParty="C" majority="22740" percentageMajority="39.36">
      <Candidate paId="56433" firstName="David" surname="Cameron" sex="M">
        <Party paId="3829" name="Conservative" abbreviation="C" votes="33973" percentageShare="58.81" />
      </Candidate>
      <Candidate paId="56612" firstName="Dawn" surname="Barnes" sex="F">
        <Party paId="3832" name="Liberal Democrat" abbreviation="LD" votes="11233" percentageShare="19.44" />
      </Candidate>
      <Candidate paId="56341" firstName="Joe" surname="Goldberg" sex="M">
        <Party paId="3830" name="Labour" abbreviation="Lab" votes="7511" percentageShare="13.00" />
      </Candidate>
      <Candidate paId="57348" firstName="Stuart" surname="Macdonald" sex="M">
        <Party paId="3835" name="Green" abbreviation="Green" votes="2385" percentageShare="4.13" />
      </Candidate>
      <Candidate paId="56282" firstName="Nikolai" surname="Tolstoy" sex="M">
        <Party paId="4175" name="UK Independence Party" abbreviation="UKIP" votes="2001" percentageShare="3.46" />
      </Candidate>
      <Candidate paId="57498" firstName="Howling" surname="Hope" sex="M">
        <Party paId="4048" name="Monster Raving Loony Party" abbreviation="Loony" votes="234" percentageShare="0.41" />
      </Candidate>
      <Candidate paId="59308" firstName="Paul" surname="Wesson" sex="M">
        <Party paId="5363" name="Independent 3" abbreviation="Ind" votes="166" percentageShare="0.29" />
      </Candidate>
      <Candidate paId="59304" firstName="Johnnie" surname="Cook" sex="M">
        <Party paId="5362" name="Independent 2" abbreviation="Ind" votes="151" percentageShare="0.26" />
      </Candidate>
      <Candidate paId="59328" firstName="Colin" surname="Bex" sex="M">
        <Party paId="4186" name="Wessex Regionalist" abbreviation="Wessex Reg" votes="62" percentageShare="0.11" />
      </Candidate>
      <Candidate paId="59298" firstName="Aaron" surname="Barschak" sex="M">
        <Party paId="3937" name="Independent" abbreviation="Ind" votes="53" percentageShare="0.09" />
      </Candidate>
    </Constituency>
  </PreviousElection>
</FirstPastThePostNominations>

Notes on the above example:

  1. The revision number in the FirstPastThePostNominations element will increment as the nominations are updated. Always use the nomination with the highest revision.
  2. The Election element name, date and type attributes uniquely identify the election.
  3. The Election type attribute is used to inform as follows:
    • G - General Election
    • L - London Assembly
    • W - Welsh Assembly
    • S - Scottish Parliament
    • E - European Parliament
  4. The Constituency name and/or number uniquely identifies the constituency.
  5. The Candidate element provides a paId for later matching to results data.
  6. The Candidate previousSittingMember attribute is * if the candidate previous sat in this constituency, or is + if the candidate sat elsewhere.
  7. The PreviousElection element is used to convey the results and candidates from the previous election, for comparision.

The nominations for a Top-up constituency are provided in a message with a TopUpNominations root element, adhering to the TopUpNominations.xsd

Here is an example of Top-up nominations from the 2014 European Parliament elections, with the filename European_Parliament_nominations_Wales_2.xml

<TopUpNominations revision="2">
  <Election name="European Parliament" date="2014-05-22" type="E">
    <Constituency number="9" name="Wales" electorate="2291186">
      <Candidate paId="97208" previousSittingMember="*" sex="F" firstName="Kay" surname="Swinburne" partyListRank="1">
        <Party paId="6355" abbreviation="C" name="Conservative" />
      </Candidate>
      <Candidate paId="97209" sex="M" firstName="Aled" surname="Wyn Davies" partyListRank="2">
        <Party paId="6355" abbreviation="C" name="Conservative" />
      </Candidate>
      <Candidate paId="97210" sex="M" firstName="Dan" surname="Boucher" partyListRank="3">
        <Party paId="6355" abbreviation="C" name="Conservative" />
      </Candidate>
      <Candidate paId="97211" sex="M" firstName="Richard" surname="Hopkin" partyListRank="4">
        <Party paId="6355" abbreviation="C" name="Conservative" />
      </Candidate>
      <Candidate paId="97282" previousSittingMember="*" sex="M" firstName="Derek" surname="Vaughan" partyListRank="1">
        <Party paId="6356" abbreviation="Lab" name="Labour" />
      </Candidate>
    </Constituency>
  </Election>
  <PreviousElection name="European Parliament" date="2009-06-04" type="E">
    <Constituency number="9" name="Wales" turnout="684520" percentageTurnout="30.40" winningParty="C" majority="6341" percentageMajority="0.93">
      <Candidate elected="*" paId="43648" firstName="Kay" surname="Swinburne" sex="F">
        <Party paId="4926" abbreviation="C" name="Conservative" />
      </Candidate>
      <Candidate elected="*" paId="43705" firstName="Derek" surname="Vaughan" sex="M">
        <Party paId="4927" abbreviation="Lab" name="Labour" />
      </Candidate>
      <Candidate elected="*" paId="47489" firstName="Jill" surname="Evans" sex="F">
        <Party paId="4929" abbreviation="PC" name="Plaid Cymru" />
      </Candidate>
      <Candidate elected="*" paId="48513" firstName="John" surname="Bufton" sex="M">
        <Party paId="4972" abbreviation="UKIP" name="UK Independence Party" />
      </Candidate>
      <Party paId="4926" abbreviation="C" name="Conservative" votes=&qEuropean_Parliament_rush_Wales_4.xmluot;145193" percentageShare="21.21" candidatesElected="1" />
      <Party paId="4927" abbreviation="Lab" name="Labour" votes="138852" percentageShare="20.28" candidatesElected="1" />
      <Party paId="4929" abbreviation="PC" name="Plaid Cymru" votes="126702" percentageShare="18.51" candidatesElected="1" />
      <Party paId="4972" abbreviation="UKIP" name="UK Independence Party" votes="87585" percentageShare="12.80" candidatesElected="1" />
      <Party paId="4928" abbreviation="LD" name="Liberal Democrat" votes="73082" percentageShare="10.68" />
      <Party paId="4931" abbreviation="Green" name="Green" votes="38160" percentageShare="5.57" />
      <Party paId="4937" abbreviation="BNP" name="British National Party" votes="37114" percentageShare="5.42" />
      <Party paId="5150" abbreviation="CP-CPA" name="Christian Party - Christian People's Alliance" votes="13037" percentageShare="1.90" />
      <Party paId="4968" abbreviation="Soc Lab" name="Socialist Labour Party" votes="12402" percentageShare="1.81" />
      <Party paId="5151" abbreviation="NO2EU" name="NO2EU" votes="8600" percentageShare="1.26" />
      <Party paId="5152" abbreviation="Jury Team" name="Jury Team" votes="3793" percentageShare="0.55" />
    </Constituency>
  </PreviousElection>
</TopUpNominations>
        

The number of candidates has been reduced for brevity. Notes on this message are:

  1. The Candidate partyListRank value is used to rank multiple candidates standing for the same party, starting from 1.
  2. In the PreviousElection data, candidates are marked as having been elected by the elected attribute of *. The Party elements provide the votes each party received and how many of their candidates were elected.

Rushes and Results

As soon as it is known, a rush message is provided for FPTP and Top-up constituencies detailing the winning party or elected candidates.

The filename convention for these rushes is:

{Election name}_rush_{Constituency name}_{Revision}.xml

A first-past-the-post rush message lists the candidates (corresponding to the nominations message for that constituency) and states which one has been elected. The rush message also contains the piece of text which goes out on the wire. Each rush message also has a revision number, which is the same as the number of the result message associated with it. When a correction is made to a result, a new rush message is only generated if the winning party in the correction differs from that originally announced. This could even happen before the full result is declared, if there has been an error in the winning party announcement. A rush correction will have an incremented revision number from the last rush or result.

A rush for a FPTP constituency uses a FirstPastThePostRush root element and adheres to the FirstPastThePostRush.xsd

Here is an example of a FPTP rush message from the 2015 General Election, using the filename General_Election_rush_Witney_1.xml:

<FirstPastThePostRush revision="1">
  <Election name="General Election" date="2015-05-07" type="G">
    <Constituency number="627" name="Witney" electorate="79767" gainOrHold="hold" winningPartyAbbreviation="C" winningPartyName="Conservative" sittingPartyAbbreviation="C" sittingPartyName="Conservative" change="false" paStyleMessageText="Prime Minister David Cameron holds Witney - Conservative hold">
      <Candidate elected="*" previousSittingMember="*" paId="59925" sex="M" firstName="David" surname="Cameron" rushText="Prime Minister David Cameron">
        <Party paId="5371" name="Conservative" abbreviation="C" />
      </Candidate>
      <Candidate paId="98884" sex="M" firstName="Duncan" surname="Enright">
        <Party paId="5372" name="Labour" abbreviation="Lab" />
      </Candidate>
      <Candidate paId="112731" sex="M" firstName="Andrew" surname="Graham">
        <Party paId="5374" name="Liberal Democrat" abbreviation="LD" />
      </Candidate>
      <Candidate paId="113805" sex="M" firstName="Stuart" surname="Macdonald">
        <Party paId="5377" name="Green" abbreviation="Green" />
      </Candidate>
      <Candidate paId="98996" sex="M" firstName="Simon" surname="Strutt">
        <Party paId="5506" name="UK Independence Party" abbreviation="UKIP" />
      </Candidate>
      <Candidate paId="115517" sex="M" firstName="Bobby" surname="Smith">
        <Party paId="7890" name="Vote Elmo" abbreviation="Elmo" />
      </Candidate>
      <Candidate paId="115510" sex="M" firstName="Chris" surname="Tompson">
        <Party paId="5427" name="Independent" abbreviation="Ind" />
      </Candidate>
      <Candidate paId="115514" sex="M" firstName="Deek" surname="Jackson">
        <Party paId="7888" name="Land Party" abbreviation="LP" />
      </Candidate>
      <Candidate paId="115578" sex="M" firstName="Nathan" surname="Handley">
        <Party paId="5467" name="No description" abbreviation="ND" />
      </Candidate>
      <Candidate paId="115515" sex="M" firstName="Clive" surname="Peedell">
        <Party paId="7843" name="National Health Action Party" abbreviation="NHAP" />
      </Candidate>
      <Candidate paId="115516" sex="F" firstName="Vivien" surname="Saunders">
        <Party paId="7889" name="Reduce VAT In Sport" abbreviation="VAT" />
      </Candidate>
      <Candidate paId="115512" sex="M" firstName="Colin" surname="Bex">
        <Party paId="5510" name="Wessex Regionalist" abbreviation="Wessex Reg" />
      </Candidate>
    </Constituency>
  </Election>
</FirstPastThePostRush>
        

Notes on the above message:

  1. The Constituency element provides useful information on the winning party and current sitting party.
  2. The PA style rush text is provided in the Constituency paStyleMessageText attribute, which maybe customised for certain seats.
  3. The Candidate standing for the winning party will be marked as elected with a *
  4. Some candidates may have a customised rushText attribute, for instance a Prime Minister.

A rush for a Top-up constituency uses a TopUpRush root element and adheres to the TopUpRush.xsd

Here is an example of a Top-up rush message for a test Election, using the filename European_Parliament_rush_Wales_1.xml:

<TopUpRush revision="1">
  <Election name="European Parliament" date="2014-05-22" type="E">
    <Constituency number="9" name="Wales" electorate="2291186">
      <Candidate elected="*" previousSittingMember="*" paId="97208" sex="F" firstName="Kay" surname="Swinburne" partyListRank="1">
        <Party paId="6355" abbreviation="C" name="Conservative" />
      </Candidate>
      <Candidate elected="*" previousSittingMember="*" paId="97282" sex="M" firstName="Derek" surname="Vaughan" partyListRank="1">
        <Party paId="6356" abbreviation="Lab" name="Labour" />
      </Candidate>
      <Candidate elected="*" previousSittingMember="*" paId="97473" sex="F" firstName="Jill" surname="Evans" partyListRank="1">
        <Party paId="6358" abbreviation="PC" name="Plaid Cymru" />
      </Candidate>
      <Candidate elected="*" paId="97395" sex="M" firstName="Nathan" surname="Gill" partyListRank="1">
        <Party paId="6414" abbreviation="UKIP" name="UK Independence Party" />
      </Candidate>
    </Constituency>
  </Election>
</TopUpRush>
        

Notes on this message:

  1. Only the candidates that have been elected are provided.
  2. The party vote share is not yet known and is provided by the full Top-up result.

Results messages for FPTP and Top-up constituencies follow the following filename pattern:

{Election name}_result_{Constituency name}_{Revision}.xml

A full result for a FPTP constituency uses a FirstPastThePostResult root element and adheres to the FirstPastThePostResult.xsd

Here is an example of a FPTP result message from the 2015 General Election, using the filename General_Election_result_Witney_1.xml:

<FirstPastThePostResult revision="1" declarationTime="2015-05-08T05:51:34+01:00">
  <Election name="General Election" date="2015-05-07" type="G">
    <Constituency number="627" name="Witney" electorate="79767" turnout="58482" percentageTurnout="73.32" percentageChangeTurnout="-0.03" winningParty="C" gainOrHold="hold" sittingParty="C" majority="25155" percentageMajority="43.01" percentageChangeMajority="-0.03" swing="1.40" swingTo="Lab" swingFrom="C">
      <Candidate elected="*" previousSittingMember="*" paId="59925" sex="M" firstName="David" surname="Cameron" rushText="Prime Minister David Cameron">
        <Party paId="5371" name="Conservative" abbreviation="C" votes="35201" percentageShare="60.19" percentageShareChange="+1.38" />
      </Candidate>
      <Candidate paId="98884" sex="M" firstName="Duncan" surname="Enright">
        <Party paId="5372" name="Labour" abbreviation="Lab" votes="10046" percentageShare="17.18" percentageShareChange="+4.18" />
      </Candidate>
      <Candidate paId="98996" sex="M" firstName="Simon" surname="Strutt">
        <Party paId="5506" name="UK Independence Party" abbreviation="UKIP" votes="5352" percentageShare="9.15" percentageShareChange="+5.69" />
      </Candidate>
      <Candidate paId="112731" sex="M" firstName="Andrew" surname="Graham">
        <Party paId="5374" name="Liberal Democrat" abbreviation="LD" votes="3953" percentageShare="6.76" percentageShareChange="-12.69" />
      </Candidate>
      <Candidate paId="113805" sex="M" firstName="Stuart" surname="Macdonald">
        <Party paId="5377" name="Green" abbreviation="Green" votes="2970" percentageShare="5.08" percentageShareChange="+0.95" />
      </Candidate>
      <Candidate paId="115515" sex="M" firstName="Clive" surname="Peedell">
        <Party paId="7843" name="National Health Action Party" abbreviation="NHAP" votes="616" percentageShare="1.05" />
      </Candidate>
      <Candidate paId="115512" sex="M" firstName="Colin" surname="Bex">
        <Party paId="5510" name="Wessex Regionalist" abbreviation="Wessex Reg" votes="110" percentageShare="0.19" percentageShareChange="+0.08" />
      </Candidate>
      <Candidate paId="115510" sex="M" firstName="Chris" surname="Tompson">
        <Party paId="5427" name="Independent" abbreviation="Ind" votes="94" percentageShare="0.16" percentageShareChange="+0.07" />
      </Candidate>
      <Candidate paId="115516" sex="F" firstName="Vivien" surname="Saunders">
        <Party paId="7889" name="Reduce VAT In Sport" abbreviation="VAT" votes="56" percentageShare="0.10" />
      </Candidate>
      <Candidate paId="115517" sex="M" firstName="Bobby" surname="Smith">
        <Party paId="7890" name="Vote Elmo" abbreviation="Elmo" votes="37" percentageShare="0.06" />
      </Candidate>
      <Candidate paId="115514" sex="M" firstName="Deek" surname="Jackson">
        <Party paId="7888" name="Land Party" abbreviation="LP" votes="35" percentageShare="0.06" />
      </Candidate>
      <Candidate paId="115578" sex="M" firstName="Nathan" surname="Handley">
        <Party paId="5467" name="No description" abbreviation="ND" votes="12" percentageShare="0.02" />
      </Candidate>
    </Constituency>
  </Election>
  <PreviousElection name="General Election" date="2010-05-06" type="G">
    <Constituency number="627" name="Witney" turnout="57769" percentageTurnout="73.34" winningParty="C" majority="22740" percentageMajority="39.36">
      <Candidate paId="56433" firstName="David" surname="Cameron" sex="M">
        <Party paId="3829" name="Conservative" abbreviation="C" votes="33973" percentageShare="58.81" />
      </Candidate>
      <Candidate paId="56612" firstName="Dawn" surname="Barnes" sex="F">
        <Party paId="3832" name="Liberal Democrat" abbreviation="LD" votes="11233" percentageShare="19.44" />
      </Candidate>
      <Candidate paId="56341" firstName="Joe" surname="Goldberg" sex="M">
        <Party paId="3830" name="Labour" abbreviation="Lab" votes="7511" percentageShare="13.00" />
      </Candidate>
      <Candidate paId="57348" firstName="Stuart" surname="Macdonald" sex="M">
        <Party paId="3835" name="Green" abbreviation="Green" votes="2385" percentageShare="4.13" />
      </Candidate>
      <Candidate paId="56282" firstName="Nikolai" surname="Tolstoy" sex="M">
        <Party paId="4175" name="UK Independence Party" abbreviation="UKIP" votes="2001" percentageShare="3.46" />
      </Candidate>
      <Candidate paId="57498" firstName="Howling" surname="Hope" sex="M">
        <Party paId="4048" name="Monster Raving Loony Party" abbreviation="Loony" votes="234" percentageShare="0.41" />
      </Candidate>
      <Candidate paId="59308" firstName="Paul" surname="Wesson" sex="M">
        <Party paId="5363" name="Independent 3" abbreviation="Ind" votes="166" percentageShare="0.29" />
      </Candidate>
      <Candidate paId="59304" firstName="Johnnie" surname="Cook" sex="M">
        <Party paId="5362" name="Independent 2" abbreviation="Ind" votes="151" percentageShare="0.26" />
      </Candidate>
      <Candidate paId="59328" firstName="Colin" surname="Bex" sex="M">
        <Party paId="4186" name="Wessex Regionalist" abbreviation="Wessex Reg" votes="62" percentageShare="0.11" />
      </Candidate>
      <Candidate paId="59298" firstName="Aaron" surname="Barschak" sex="M">
        <Party paId="3937" name="Independent" abbreviation="Ind" votes="53" percentageShare="0.09" />
      </Candidate>
    </Constituency>
  </PreviousElection>
</FirstPastThePostResult>
        

Each first-past-the-post result message gives the full details of the results in a constituency, with the numbers of votes, turnout, party shares and changes in party shares since the last election. Corrections may be sent to results messages, and these are indicated by increased revision numbers. The first version of any result has same the revision number of the last rush.

If there has been a change to the winning party, causing an incremented rush revision, and naturally a change to the votes, the full result revision will be incremented again.

If only the result details are changed, with no winning party change and rush, then only a new result is sent with an incremented revision.

Results messages also contain a summary of the previous election results in the constituency.

A full result for a Top-up constituency uses a TopUpResult root element and adheres to the TopUpResult.xsd

Here is an example of a Top-up result message from the 2014 European Parliament election, using the filename European_Parliament_result_Wales_2.xml:

<TopUpResult revision="2" declarationTime="2014-05-25T23:48:02+01:00">
  <Election name="European Parliament" date="2014-05-22" type="E">
    <Constituency number="9" name="Wales" electorate="2291186" turnout="733060" percentageTurnout="31.99" percentageChangeTurnout="+1.60" winningParty="Lab" majority="4349" percentageMajority="0.59" percentageChangeMajority="+1.60" swing="3.45" swingTo="UKIP" swingFrom="Lab">
      <Candidate elected="*" previousSittingMember="*" paId="97208" sex="F" firstName="Kay" surname="Swinburne" partyListRank="1">
        <Party paId="6355" abbreviation="C" name="Conservative" />
      </Candidate>
      <Candidate elected="*" previousSittingMember="*" paId="97282" sex="M" firstName="Derek" surname="Vaughan" partyListRank="1">
        <Party paId="6356" abbreviation="Lab" name="Labour" />
      </Candidate>
      <Candidate elected="*" previousSittingMember="*" paId="97473" sex="F" firstName="Jill" surname="Evans" partyListRank="1">
        <Party paId="6358" abbreviation="PC" name="Plaid Cymru" />
      </Candidate>
      <Candidate elected="*" paId="97395" sex="M" firstName="Nathan" surname="Gill" partyListRank="1">
        <Party paId="6414" abbreviation="UKIP" name="UK Independence Party" />
      </Candidate>
      <Party paId="6356" abbreviation="Lab" name="Labour" votes="206332" percentageShare="28.15" percentageShareChange="+7.86" />
      <Party paId="6414" abbreviation="UKIP" name="UK Independence Party" votes="201983" percentageShare="27.55" percentageShareChange="+14.76" />
      <Party paId="6355" abbreviation="C" name="Conservative" votes="127742" percentageShare="17.43" percentageShareChange="-3.79" />
      <Party paId="6358" abbreviation="PC" name="Plaid Cymru" votes="111864" percentageShare="15.26" percentageShareChange="-3.25" />
      <Party paId="6360" abbreviation="Green" name="Green" votes="33275" percentageShare="4.54" percentageShareChange="-1.04" />
      <Party paId="6357" abbreviation="LD" name="Liberal Democrat" votes="28930" percentageShare="3.95" percentageShareChange="-6.73" />
      <Party paId="6367" abbreviation="BNP" name="British National Party" votes="7655" percentageShare="1.04" percentageShareChange="-4.38" />
      <Party paId="7487" abbreviation="Britain 1st" name="Britain First" votes="6633" percentageShare="0.90" />
      <Party paId="6409" abbreviation="Soc Lab" name="Socialist Labour Party" votes="4459" percentageShare="0.61" percentageShareChange="-1.20" />
      <Party paId="6394" abbreviation="NO2EU" name="NO2EU" votes="2803" percentageShare="0.38" percentageShareChange="-0.87" />
      <Party paId="6410" abbreviation="SPGB" name="Socialist Party of Great Britain" votes="1384" percentageShare="0.19" />
    </Constituency>
  </Election>
  <PreviousElection name="European Parliament" date="2009-06-04" type="E">
    <Constituency number="9" name="Wales" turnout="684520" percentageTurnout="30.40" winningParty="C" majority="6341" percentageMajority="0.93">
      <Candidate elected="*" paId="43648" firstName="Kay" surname="Swinburne" sex="F">
        <Party paId="4926" abbreviation="C" name="Conservative" />
      </Candidate>
      <Candidate elected="*" paId="43705" firstName="Derek" surname="Vaughan" sex="M">
        <Party paId="4927" abbreviation="Lab" name="Labour" />
      </Candidate>
      <Candidate elected="*" paId="47489" firstName="Jill" surname="Evans" sex="F">
        <Party paId="4929" abbreviation="PC" name="Plaid Cymru" />
      </Candidate>
      <Candidate elected="*" paId="48513" firstName="John" surname="Bufton" sex="M">
        <Party paId="4972" abbreviation="UKIP" name="UK Independence Party" />
      </Candidate>
      <Party paId="4926" abbreviation="C" name="Conservative" votes="145193" percentageShare="21.21" candidatesElected="1" />
      <Party paId="4927" abbreviation="Lab" name="Labour" votes="138852" percentageShare="20.28" candidatesElected="1" />
      <Party paId="4929" abbreviation="PC" name="Plaid Cymru" votes="126702" percentageShare="18.51" candidatesElected="1" />
      <Party paId="4972" abbreviation="UKIP" name="UK Independence Party" votes="87585" percentageShare="12.80" candidatesElected="1" />
      <Party paId="4928" abbreviation="LD" name="Liberal Democrat" votes="73082" percentageShare="10.68" />
      <Party paId="4931" abbreviation="Green" name="Green" votes="38160" percentageShare="5.57" />
      <Party paId="4937" abbreviation="BNP" name="British National Party" votes="37114" percentageShare="5.42" />
      <Party paId="5150" abbreviation="CP-CPA" name="Christian Party - Christian People's Alliance" votes="13037" percentageShare="1.90" />
      <Party paId="4968" abbreviation="Soc Lab" name="Socialist Labour Party" votes="12402" percentageShare="1.81" />
      <Party paId="5151" abbreviation="NO2EU" name="NO2EU" votes="8600" percentageShare="1.26" />
      <Party paId="5152" abbreviation="Jury Team" name="Jury Team" votes="3793" percentageShare="0.55" />
    </Constituency>
  </PreviousElection>
</TopUpResult>
        

Notes on this message:

  1. The Candidate elements provide the actual elected candidates, as in the TopUpRush.
  2. The sequence of Party elements provide the vote shares each party has received.

Recounts

Should a recount occur in a constituency it will be announced using a recount message for both FPTP and Top-up constituencies. The recount message has it's own revision number, that will increment if there are multiple recounts for the same constituency. Recount messages also provide the recount number, an indicator of how many recounts have taken place.

Recount messages following the following filename pattern:

{Election name}_recount_{Constituency name}_{Revision).xml

A recount message uses a Recount root element and adheres to the Recount.xsd

Here is an example of a recount from the the 2015 General election (that didn't really happen), using the filename General_Election_recount_Witney_1.xml:

<Recount revision="1">
  <Election name="General Election" date="2015-05-07" type="G">
    <Constituency number="627" name="Witney" recount="1" />
  </Election>
</Recount>

Note that the recount number is independent to the revision, such that corrections could cause both to diverge. Use the highest revision available, and the recount number therein is the latest e.g. recount="2" indicates a second recount

State of parties

At regular intervals a State of parties (SOP) message is generated, that summarises the seats gained, held and lost by the major parties and others. This message may also contain a forecast of the seats each party will achieve, and the possible majority, based on the results in so far and other statistics. Each SOP message is generated for the number of results in so far, which is indicated by the SOP filename and within the message.

At the end of an election, a fuller SOP message may be generated that includes the details for all participating parties, instead of those parties being grouped as others.

SOP messages follow the following filename pattern, where the 'results total' is the number of results so far:

{Election name}_SOP_{Results total}.xml

A SOP message uses the FirstPastThePostStateOfParties root element and adheres to the FirstPastThePostStateOfParties.xsd

Here is an example of a SOP message from the 2015 General Election, using the filename General_Election_SOP_100.xml:

<FirstPastThePostStateOfParties numberOfResults="100" totalNumberOfConstituencies="650" totalVotes="4379901" forecastWinningParty="C" forecastMajority="2" note="Votes cast for Speaker John Bercow at Buckingham are included in the Conservative total ">
  <Election name="General Election" date="2015-05-07" type="G" />
  <Parties>
    <Party paId="5372" name="Labour" abbreviation="Lab" totalSeats="37" gains="2" losses="20" totalVotes="1393887" percentageShare="31.82" percentageChange="-3.63" forecastSeats="219" />
    <Party paId="5371" name="Conservative" abbreviation="C" totalSeats="24" gains="2" losses="1" totalVotes="1080115" percentageShare="24.66" percentageChange="-1.52" forecastSeats="326" />
    <Party paId="5376" name="Scottish National Party" abbreviation="SNP" totalSeats="25" gains="21" totalVotes="648783" percentageShare="14.81" percentageChange="+9.06" forecastSeats="57" />
    <Party paId="5506" name="UK Independence Party" abbreviation="UKIP" totalVotes="398333" percentageShare="9.09" percentageChange="+7.33" forecastSeats="3" />
    <Party paId="5374" name="Liberal Democrat" abbreviation="LD" totalSeats="1" losses="3" totalVotes="223203" percentageShare="5.10" percentageChange="-12.06" forecastSeats="23" />
    <Party paId="5379" name="Democratic Unionist Party" abbreviation="DUP" totalSeats="6" gains="1" losses="1" totalVotes="132896" percentageShare="3.03" percentageChange="+0.18" forecastSeats="8" />
    <Party paId="5377" name="Green" abbreviation="Green" totalVotes="125257" percentageShare="2.86" percentageChange="+2.17" forecastSeats="1" />
    <Party paId="5375" name="Plaid Cymru" abbreviation="PC" totalSeats="2" totalVotes="90947" percentageShare="2.08" percentageChange="+0.03" forecastSeats="3" />
    <Party paId="5381" name="Sinn Fein" abbreviation="SF" totalSeats="2" totalVotes="74514" percentageShare="1.70" percentageChange="-0.21" forecastSeats="4" />
    <Party paId="7402" name="Ulster Unionist Party" abbreviation="UUP" totalSeats="1" gains="1" totalVotes="55851" percentageShare="1.28" forecastSeats="1" />
    <Party paId="5382" name="Alliance" abbreviation="Alliance" losses="1" totalVotes="45363" percentageShare="1.04" percentageChange="+0.26" />
    <Party paId="5380" name="Social Democratic and Labour Party" abbreviation="SDLP" totalSeats="1" totalVotes="44753" percentageShare="1.02" percentageChange="-0.10" forecastSeats="3" />
    <Party paId="-9999" name="Others" abbreviation="Others" totalSeats="1" losses="1" totalVotes="65999" percentageShare="1.51" forecastSeats="2" />
  </Parties>
  <ConstituenciesIncluded>
    <Constituency number="2" name="Aberconwy" />
    <Constituency number="6" name="Airdrie &amp; Shotts" />
    <Constituency number="12" name="Angus" />
    <Constituency number="13" name="Antrim East" />
    <Constituency number="14" name="Antrim North" />
    <Constituency number="15" name="Antrim South" />
    <Constituency number="16" name="Arfon" />
    <Constituency number="25" name="Ayrshire North &amp; Arran" />
    <Constituency number="38" name="Battersea" />
    <Constituency number="45" name="Belfast East" />
    <Constituency number="48" name="Belfast West" />
    <Constituency number="67" name="Blackburn" />
    <Constituency number="71" name="Blaenau Gwent" />
    <Constituency number="89" name="Brecon &amp; Radnorshire" />
    <Constituency number="104" name="Bromley &amp; Chislehurst" />
    <Constituency number="106" name="Broxbourne" />
    <Constituency number="109" name="Burnley" />
    <Constituency number="114" name="Caerphilly" />
    <Constituency number="131" name="Carmarthen East &amp; Dinefwr" />
    <Constituency number="134" name="Castle Point" />
    <Constituency number="135" name="Ceredigion" />
    <Constituency number="139" name="Chelmsford" />
    <Constituency number="151" name="Cities of London &amp; Westminster" />
    <Constituency number="154" name="Clwyd South" />
    <Constituency number="176" name="Darlington" />
    <Constituency number="202" name="Down North" />
    <Constituency number="209" name="Dunbartonshire East" />
    <Constituency number="210" name="Dunbartonshire West" />
    <Constituency number="211" name="Dundee East" />
    <Constituency number="212" name="Dundee West" />
    <Constituency number="215" name="Durham North" />
    <Constituency number="216" name="Durham North West" />
    <Constituency number="218" name="Ealing Central &amp; Acton" />
    <Constituency number="219" name="Ealing North" />
    <Constituency number="221" name="Easington" />
    <Constituency number="223" name="East Kilbride, Strathaven &amp; Lesmahagow" />
    <Constituency number="245" name="Falkirk" />
    <Constituency number="246" name="Fareham" />
    <Constituency number="255" name="Foyle" />
    <Constituency number="264" name="Glasgow North" />
    <Constituency number="269" name="Glenrothes" />
    <Constituency number="272" name="Gosport" />
    <Constituency number="285" name="Halton" />
    <Constituency number="286" name="Hammersmith" />
    <Constituency number="299" name="Havant" />
    <Constituency number="320" name="Houghton &amp; Sunderland South" />
    <Constituency number="330" name="Inverclyde" />
    <Constituency number="333" name="Isle of Wight" />
    <Constituency number="334" name="Islington North" />
    <Constituency number="335" name="Islington South &amp; Finsbury" />
    <Constituency number="336" name="Islwyn" />
    <Constituency number="337" name="Jarrow" />
    <Constituency number="341" name="Kettering" />
    <Constituency number="342" name="Kilmarnock &amp; Loudoun" />
    <Constituency number="345" name="Kirkcaldy &amp; Cowdenbeath" />
    <Constituency number="347" name="Lagan Valley" />
    <Constituency number="348" name="Lanark &amp; Hamilton East" />
    <Constituency number="375" name="Llanelli" />
    <Constituency number="393" name="Merthyr Tydfil &amp; Rhymney" />
    <Constituency number="396" name="Midlothian" />
    <Constituency number="399" name="Mitcham &amp; Morden" />
    <Constituency number="402" name="Montgomeryshire" />
    <Constituency number="403" name="Moray" />
    <Constituency number="406" name="Motherwell &amp; Wishaw" />
    <Constituency number="407" name="Na h-Eileanan an Iar" />
    <Constituency number="414" name="Newcastle upon Tyne Central" />
    <Constituency number="415" name="Newcastle upon Tyne East" />
    <Constituency number="416" name="Newcastle upon Tyne North" />
    <Constituency number="417" name="Newport East" />
    <Constituency number="418" name="Newport West" />
    <Constituency number="435" name="Nuneaton" />
    <Constituency number="436" name="Ochil &amp; Perthshire South" />
    <Constituency number="443" name="Oxford East" />
    <Constituency number="445" name="Paisley &amp; Renfrewshire North" />
    <Constituency number="446" name="Paisley &amp; Renfrewshire South" />
    <Constituency number="451" name="Peterborough" />
    <Constituency number="462" name="Putney" />
    <Constituency number="469" name="Renfrewshire East" />
    <Constituency number="470" name="Rhondda" />
    <Constituency number="487" name="Rutherglen &amp; Hamilton West" />
    <Constituency number="522" name="South Shields" />
    <Constituency number="525" name="Southend West" />
    <Constituency number="533" name="Stirling" />
    <Constituency number="542" name="Strangford" />
    <Constituency number="544" name="Streatham" />
    <Constituency number="551" name="Sunderland Central" />
    <Constituency number="560" name="Swindon North" />
    <Constituency number="561" name="Swindon South" />
    <Constituency number="574" name="Tooting" />
    <Constituency number="576" name="Torfaen" />
    <Constituency number="578" name="Tottenham" />
    <Constituency number="584" name="Tyrone West" />
    <Constituency number="586" name="Upper Bann" />
    <Constituency number="588" name="Vale of Clwyd" />
    <Constituency number="602" name="Warwickshire North" />
    <Constituency number="603" name="Washington &amp; Sunderland West" />
    <Constituency number="615" name="Westminster North" />
    <Constituency number="621" name="Wimbledon" />
    <Constituency number="633" name="Worcester" />
    <Constituency number="641" name="Wrexham" />
  </ConstituenciesIncluded>
</FirstPastThePostStateOfParties>
        

Making use of ‘PA IDs’ of candidates and parties

The XML message feed contains an enhancement which is not available in the other feed formats, namely unique ID numbers for each candidate and party. These can be relied upon to match candidates from nominations messages to results messages, and to uniquely identify different independent candidates. They cannot be used to match candidates between elections, though: due to the complexity of identifying that candidate J. Smith standing in constituency X in 2007 is the same J. Smith standing in constituency Y in 2011, PA’s software does not attempt to make that link, so the candidate IDs will actually be different in the two elections. For similar reasons, party IDs are also different between different elections.

Queries and comments

If you have any technical queries or comments relating to the XML message feed, please contact Press Association Customer Services, and they will quickly pass on the message to the relevant person.

Top of page