Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: cpeckhamHi!
This time I am parsing KML output from batchgeo.com.
Here is a sample (2 records + closing).
<?xml version="1.0"?><kml xmlns="
http://earth.google.com/kml/2.0"><Document><name>Site List with Site Name</name><description> | Created with
http://batchgeo.com</description><style id="0"><BalloonStyle><text><![CDATA[ <b>$[name]</b><br />$[address]<br />$[description]<br/><br/>$[geDirections] ]]></text></BalloonStyle></style><Placemark><description><div><span class="l">Site:</span>&nbsp;BRHOAL</div></description><Point><coordinates>-86.821308387064,33.499887140373,0</coordinates></Point><address>401 6th St S Birmingham, AL </address><styleUrl>#0</styleUrl></Placemark><Placemark><description><div><s pan class="l">Site:</span>&nbsp;LTRKAR</div></description><Point><coordinates>-92.278127642797,34.746886017451,0</coordinates></Point><address>300 S Gaines Street Little Rock, AR </address><styleUrl>#0</styleUrl></Placemark><Placemark><description><div><s pan class="l">Site:</span>&nbsp;PHNXAZ</div></description><Point><coordinates>-112.35812226567,33.406499811075,0</coordinates></Point><address>13936 West Broadway Goodyear, AZ </address><styleUrl>#0</styleUrl></Placemark></Document><kml>
My settings for the Tabular XML File Node:
RecordXPath: /kml/Document/Placemark
FieldNameXPath: /kml/Document/Placement/*
FieldNameFunction: local-name()
FieldValueXPath: /kml/Document/Placemark/*/text()
FieldValueFunction: <blank>
I have also tried to use the regular XMLpy node:
@elementHandler('/kml/Document/Placemark')
def EntryHandler(element):
data = {}
data['description'] = element.description
data['Point'] = element.Point.coordinates
data['address'] = element.address
outputRecord(data, 0)
Ignoring the "&" phrases (which I can strip out once I get them into fields), I get no records processed. ("No output produced. No tags matched the RecordXPath expression [/kml/Document/Placemark]. Therefore, no output records were produced.").
What did I miss? Any suggestions?
Thanks in advance for your help.
-cp