Creating a feature class off of an XML feed

268
1
05-18-2011 07:44 AM
PhilHolleran
Occasional Contributor
I am attempting to create a feature class off of some Minnesota Department of Transportation XML feeds.  The first XML feed displays current incidents on roadways and provides all information about the incident as attributes in a single XML tag:

[INDENT]<active_incidents time_stamp="Tue May 17 10:09:07 CDT 2011">

<incident id="2011051709091759" event_type="INCIDENT_ROADWORK" event_date="Tue May 17 09:15:29 CDT 2011" lane_type="Exit" road="T.H.100" dir="NB" location="@ 57th Ave" easting="475468" northing="4989338" camera="C226" impact="..!" cleared="false"/>

<incident id="2011051709061520" event_type="INCIDENT_ROADWORK" event_date="Tue May 17 09:12:27 CDT 2011" lane_type="Exit" road="T.H.100" dir="NB" location="@ Glenwood Ave" easting="472923" northing="4980428" camera="C217" impact="!!!" cleared="false"/>

</active_incidents>
[/INDENT]

I am having some trouble deciding what the most efficient workflow would be to parse this XML feed into a feature class off of which a service could be generated.  The XML file (http://www.dot.state.mn.us/tmc/trafficinfo/incidents.xml) is updated every 30 seconds, and I would like the service to be as closely in synch with the xml file as possible.

I would appreciate any input on the most efficient way to continuously update (delete old records, insert new) a feature class and the best method for parsing this XML file.
0 Kudos
1 Reply
KimOllivier
Occasional Contributor III
I used the standard module ElementTree to parse XML for a GPX file as hinted by a Python demo at the conference. This is much easier than some of the older parsers such as SAX or DOM.
0 Kudos