Skip to content

Instantly share code, notes, and snippets.

@krisbulman
Created October 26, 2011 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krisbulman/1317537 to your computer and use it in GitHub Desktop.
Save krisbulman/1317537 to your computer and use it in GitHub Desktop.
This is a DBIx-XML-DataLoader-1.1b map file to map the elections pei xml feed to PostgreSQL
<XMLtoDB>
<dbinfo dbuser="postgres" dbpass="password" dbsource="dbi:Pg:dbname=peivotes;host=localhost;port=5432" name="peivotesca"/>
<RootElement name="rss"/>
<DocKeyColumn name="guid"/>
<Table name="Candidates" dbname="peivotes" xpath="./channel/item/electionspei:ballotcount">
<KeyColumn name="GID" order="1"/>
<KeyColumn name="Poll" order="2"/>
<KeyColumn name="Dist_no" order="3"/>
<KeyColumn name="Party" order="4"/>
<Element xpath="../electionspei:pollname" toColumn="Pollname"/>
<Element xpath="../electionspei:poll" toColumn="Poll"/>
<Element xpath="../electionspei:districtname" toColumn="Dist_name"/>
<Element xpath="../electionspei:districtnumber" toColumn="Dist_no"/>
<Element xpath="./@party" toColumn="Party" />
<Element xpath="./@lastname" toColumn="Last_Name" />
<Element xpath="./@firstname" toColumn="First_Name" />
<Element xpath="./@pollvotes" toColumn="Pollvotes" />
<Element xpath="./@totalvotes" toColumn="Totalvotes" />
</Table>
</XMLtoDB>
@krisbulman
Copy link
Author

this map file expects a database called peivotesca, that has a table called candidates with the following columns:

gid
poll
dist_no
party
last_name
first_name
pollvotes
totalvotes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment