0
votes

I am attempting to parse a KML file which has some non-standard tags:

<Placemark id="plot">
<Type1> Type 1 </Type1>
<SA>62</SA>
<Type2> Type 2 </Type2>

I'm attempting to read/parse the file, obtain the representative elements as described above and then all the coordinates, and finally write the output to a text file for downstream use. I'm able to parse the file and get the coordinates with no issues but have been unable to determine a way to get the custom elements, and I need the data to format the output file correctly. The elements are not wrapped in an extendeddata structure or any other grouping.

I am hoping someone has run into this before and can offer some guidance on the best way to read the data via supplied methods for javaapiforkml.

1
How are you parsing kml data? - TheLittleNaruto
the snippet you have included is not xml. Can you post a better snippet? - ControlAltDel
Hi. Sorry, it's a KML file. The section I included is a placemark tag. There are hundreds in the KML file. I was just trying to highlight the custom fields and how they are represented in the file. - user7972
I'm using the "javaapiforkml" plug-in, which unmarshalls the KML file to Java objects and provides methods for accessing. - user7972

1 Answers

0
votes

You can have a look at OSMBonusPack KML parser, mainly here.

It's open source, so you can pick the classes you need, remove all Android-specific features, and add handling for your custom tags.