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 a fictional example of a FPTP nominations message based on 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" ballotName="Cameron, David William">
        <Party paId="5371" name="Conservative" abbreviation="C" />
      </Candidate>
      <Candidate paId="98884" sex="M" firstName="Duncan" surname="Enright" ballotName="Enright, Duncan">
        <Party paId="5372" name="Labour" abbreviation="Lab" />
      </Candidate>
      <Candidate paId="112731" sex="M" firstName="Andrew" surname="Graham" ballotName="Graham, Andrew Marcus">
        <Party paId="5374" name="Liberal Democrat" abbreviation="LD" />
      </Candidate>
      <Candidate paId="113805" sex="M" firstName="Stuart" surname="Macdonald" ballotName="Macdonald, Stuart Richard">
        <Party paId="5377" name="Green" abbreviation="Green" />
      </Candidate>
      <Candidate paId="98996" sex="M" firstName="Simon" surname="Strutt" ballotName="Strutt, Simon">
        <Party paId="5506" name="UK Independence Party" abbreviation="UKIP" />
      </Candidate>
      <Candidate paId="115517" sex="M" firstName="Bobby" surname="Smith" ballotName="Smith, Robert George">
        <Party paId="7890" name="Vote Elmo" abbreviation="Elmo" />
      </Candidate>
      <Candidate paId="115510" sex="M" firstName="Chris" surname="Tompson" ballotName="Tompson, Christopher">
        <Party paId="5427" name="Independent" abbreviation="Ind" />
      </Candidate>
      <Candidate paId="115514" sex="M" firstName="Deek" surname="Jackson" ballotName="Jackson, Deek">
        <Party paId="7888" name="Land Party" abbreviation="LP" />
      </Candidate>
      <Candidate paId="115578" sex="M" firstName="Nathan" surname="Handley" ballotName="Handley, Nathan">
        <Party paId="5467" name="No description" abbreviation="ND" />
      </Candidate>
      <Candidate paId="115515" sex="M" firstName="Clive" surname="Peedell" ballotName="Peedell, Clive Richard">
        <Party paId="7843" name="National Health Action Party" abbreviation="NHAP" />
      </Candidate>
      <Candidate paId="115516" sex="F" firstName="Vivien" surname="Saunders" ballotName="Saunders, Vivien Lisa">
        <Party paId="7889" name="Reduce VAT In Sport" abbreviation="VAT" />
      </Candidate>
      <Candidate paId="115512" sex="M" firstName="Colin" surname="Bex" ballotName="Bex, Colin">
        <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. The Press Association uses its own long standing convention for constituency names, which may not agree with other data sources and media publishers. We use only plain ASCII characters.
  5. The electorate figure for a constituency is available, when known, in the optional electorate attribute. This figure is only published when known, and may be corrected several times in the lead up to an election. It is critical for the calculation of turnout percentages and other interesting statistics.
  6. The Candidate element provides a paId for later matching to results data.
  7. The Candidate previousSittingMember attribute is * if the candidate previous sat in this constituency, or is + if the candidate sat elsewhere.
  8. The new ballotName attribute, which is optional, provides the more formal name of the candidate as found on the ballot paper. This is comprised of the surname, then a comma, followed by no more than two space separated first names. The first name will be the more formal version as opposed the 'known as' first name normally used e.g. Peter rather than Pete. If the candidate has no first names only the surname will be provided in this attribute. If the candidate is historical and is missing this data, the ballotName attribute will be absent.

    Owing to a customer requirement limiting the first names to no more than two words, this attribute is best used for checking purposes and not for publication.

  9. Within the Candidate element, the Party element provides the party that the candidate is standing for. From this the party ID, name and abbreviation can be extracted. The party information will repeat with the same details for all candidates standing for the same party across all nominations in the election.
  10. Independent and No description party candidates may have been disambiguated to have their own party e.g. "Independent Derek Jones". However they will still be associated with a generic "Independent" party and will be treated as such in statistical calculations. For example, a new independent winning a seat from a previous independent is regarded as an "Independent hold" and no change in party. Disambiguated independents and no description candidates will share the same generic abbreviation as the 'parent' party e.g. Ind or ND.
  11. 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="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 the same as for FPTP nominations as well as:

  1. The Candidate partyListRank value is used to rank multiple candidates standing for the same party, starting from 1.
  2. Though not shown above, the Candidate element may also contain a ballotName attribute as described for FPTP nominations.
  3. 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. A rush is sent as quickly as possible before the full details of the result are known.

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 the same information as in the nominations, but with useful information on the winning party and current sitting party. The winning party can be extracted from the winningParty or winningPartyAbbreviation attributes. The gain or hold status is in the gainOrHold attribute, based on the sitting party. If there has been a change of control, the change attribute is set to true.
  2. The PA style rush text is provided in the Constituency paStyleMessageText attribute, which maybe customised for certain seats. This is useful for a special display of the result, rather than something automatically constructed from the results data. It is typically set for the Prime Minister and other significant candidates.
  3. Looking at the Candidate elements, only the standing for the winning party will be marked as elected with a * in the elected="*' attribute.
  4. The votes for each candidate are not known at this stage, so are not displayed. The intention is to display the declared winner as quickly as possible.
  5. Though not shown above, the Candidate element may also contain a ballotName attribute as described for FPTP nominations.

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 are largely the same as for a FPTP rush as well as:

  1. Only the candidates that have been elected are provided, unlike a FPTP rush.
  2. The party vote share is not yet known and is provided by the full Top-up result that shortly follows.
  3. Though not shown above, the Candidate element may also contain a ballotName attribute as described for FPTP nominations.
  4. The partyListRank attribute indicates the desired order of preference for election as declared by the parties concerned. Those with rank 1 are elected first, and so on, according to the rules of proportional representation.

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.

Notes on this type of message are the same as a rush message as well as:

  1. Since the votes are now known, the Constituency element is populated wih statistics based on the votes, turnout and electorate. For example:
    • turnout is the total votes, excluding spoiled papers.
    • percentageTurnout is calculated from the turnout and the electorate.
    • percentageChangeTurnout is the difference in percentageTurnout from the last election result in this constituency.
    • winning party attributes are the same as in the rush.
    • majority is the difference in votes between the winning candidate and the next runner up.
    • percentageMajority is that majority as a percentage of the turnout.
    • percentageChangeMajority is the change in percentageMajority compared to the majority of the last result in this constituency. It is irrespective of parties and candidates.
    • swing is a calculation of the swing between the first and second parties, using the vote shares this time and in the last constituency result. If the two parties did not participate in both results, no swing can be calculated. The swingTo and swingFrom attributes, as party abbreviations, must be used to determine the direction of swing. Parties such as The Speaker, Labour Co-op, disambiguated independents and no description candidates are associated with a parent party. For example Labour Co-op is treated as Labour, when calculating swing.
  2. Though not shown above, the Candidate element may also contain a ballotName attribute as described for FPTP nominations.
  3. 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 are the same as for a FPTP results as well as:

  1. The Candidate elements provide the actual elected candidates, as in the TopUpRush.
  2. Though not shown above, the Candidate element may also contain a ballotName attribute as described for FPTP nominations.
  3. The sequence of Party elements provide the vote shares each party has received. Not all parties listed here will have an elected candidate if they have not received enougth votes.

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>

Notes on this type of message:

  1. The revision number increments as each recount is announced. Always use the highest number for the constituency.
  2. 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.

The State of the Parties statistic is only generated after each result early on and towards the end. Trying to generate it after each result when results are flowing at high volumes could cause delays and see statistics running out of sequence. The SoP frequency is set in advance to go from after each result from the beginning to after every five results as volumes increase, then 10, then 20 – before falling back as volumes decrease, to 10, then 5 and then again after each result through to the end.

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. This type of message will have a different filename and will sit alongside the standard SOP message.

The forecast information will only be present in the SOP messages once a suitable amount of results are in, to enable it's calculation. At the very end of the election, when all results are in, the forecast becomes redundant and will therefore be removed from the SOP message.

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

{Election name}_SOP_{Results total}.xml

The SOP message containing details of all parties uses the following filename pattern:

{Election name}_All_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>

Notes on this type of message:

  1. The root element provides the number of results so far in the numberOfResults attribute, out of the total totalNumberOfConstituencies value.
  2. The totalVotes attribute provided the total votes received so far for all results in the election.
  3. The Press Association will, at a suitable point in the election, activate a forecasting feature. This will manifest as the forecastWinningParty and forecastMajority attributes. The forecast is calculated using factors such as the current swing from results so far and the vote shares from the previous election. A seat forecast is then made for every constituency, which may lead to an overall forecast majority. If no majority is forecast, the forecastWinningParty is set to "No overall majority" and forecastMajority figure is not provided. Forecasting will automatically disappear when all results are in.
  4. The note attribute serves as an editorial note regarding the handling of parties. For instance it may explain how the Speaker is handled.
  5. The Party elements are ordered by votes descending. Only the major parties are shown during the course of the election. The results for other parties, such as independents, are aggregated under the special "Others" party with a preset ID of -9999. At the very end of an election, a SOP message for all parties is generated that includes every single party. The others grouping will not appear in the all parties message.
  6. Within the Party elements the usual party details are provided but with aggregated totals for the party such as:
    • totalSeats is the number of seats won by the party across results so far.
    • gains, which is optional, is the seats gained from a previously different sitting party.
    • losses, which is optional, is the seats lost by a sitting party.
    • totalVotes is the total votes received by the party across the results received so far.
    • percentageShare is the share of the parties votes out of the total votes so far.
    • percentageChange is the change in the parties share compared to the same point in the last election, using the same constituency results from last time.
    • forecastSeats, which is optional, will appear when forecasts are enabled. This provides the forecast number of seats for this party based on a number of factors. Absence implies zero if forecasts are enabled.
  7. The ConstituenciesIncluded element, containing one or more Constituency elements, provides the basic details of the constituencies for which results are received so far.

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.

Please be aware that the IDs of candidates and parties seen in election tests will not be the same as in real elections. The PA cannot conduct tests using real elections because of the ramifications of using real candidate names, therefore test elections are created to serve this purpose. Therefore these test elections have their own set of test entities, including fictional candidate names.

Please do not set-up your system to expect results from a real election to have the IDs seen in election tests, conducted before the election. The party names and abbreviations may be the same but the IDs will be different. Instead, use the real nominations to set-up your system and gain the real party and candidate IDs.

Handling of associated parties

Some parties are associated with a 'parent' party, so that they may be grouped under that party when calculating certain result statistics. For example, the Labour and Co-operative party (Lab Co-op) is for all intents and purposes the Labour Party, so it is associated with Labour and treated as such in calculations.

In nominations, rush and results messages the precise party id, name and abbreviation is always given. However the calculation of gain/hold/lose to the current sitting party, or swing, is made using the parent associated party. Thus for Labour Co-op these calculations would be made using Labour.

Another important association is the special case of 'The Speaker', who appears as his/her own party. The Speaker party will be associated with one of the two main parties (normally), regardless of that party being in power at the time. Therefore calculations of change involving The Speaker take into account the parent associated party.

The State of parties (SOP) messages provide statistical information on the progress of the major, and sometimes all, parties in the election. Regarding party associations, the SOP message always shows the parent parties, counting the seats and votes for a child associated party as for the parent.

Therefore Labour Co-op and The Speaker will never appear by themselves, because they have been included in the Labour and/or Conservative totals. Likewise any Independent votes will be grouped under the generic party of 'Independent', even if the winning Independent candidate has been published with their own party in the nominations and results.

Disambiguation of Independent and No description parties

In most cases a single 'Independent' or 'No description' candidate in a constituency will be published as standing for the generic 'Independent' or 'No description' party. In those cases where multiple Independent or No description candidates are standing, they will be disambiguated into their own specific parties. Each disambiguated party will have it's own id and will be associated with the parent generic party of Independent or No description - and will share the same abbreviation of 'Ind' or 'ND'.

For example, two Independents are standing so they are disambiguated into the following two parties:

  • Independent {first candidate name}
  • Independent {second candidate name}

Likewise a No description candidate would have a party of 'No description {candidate name}'.

Although the disambiguated parties are published as such in the nominations, rushes and results, the association with the generic parent parties of Independent or No description causes then to be treated as the parent in calculations.

Therefore you will only see statistics for the generic Independent and No description parties in the State of Party (SOP) messages, in the knowledge that the disambiguated party totals have been included in the parent totals.

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