i have an xml output from a webservice in a variable “results”
it looks something like this,
<ArrayOfSeriesRecord xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://hiscentral.cuahsi.org/20100205/">
<SeriesRecord>
<ServCode>IIHRTippingB</ServCode>
<ServURL>
http://his08.iihr.uiowa.edu/tippingbucket/cuahsi_1_0.asmx?WSDL
</ServURL>
<location>IIHR:CC00</location>
<VarCode>IIHR:Precipitation</VarCode>
<VarName>Precipitation</VarName>
<beginDate>9/25/2006 12:00:00 AM</beginDate>
<endDate>5/7/2011 12:00:00 AM</endDate>
<ValueCount>161738</ValueCount>
<Sitename>CC00</Sitename>
<latitude>41.736152648925781</latitude>
<longitude>-91.931015014648438</longitude>
<datatype>Continuous</datatype>
<valuetype>FieldObservation</valuetype>
<samplemedium>Precipitation</samplemedium>
<timeunits>minute</timeunits>
<conceptKeyword>Precipitation</conceptKeyword>
<genCategory/>
<TimeSupport>15</TimeSupport>
</SeriesRecord>
i need to parse this xml to get the latitude and longitude and plot it on google maps..
any idea how i can do that..
please help
thanx in advance.. :))
My favorite method for parsing xml is to use JAXB. You need an XML Schema Definition file that lays out how the XML will be structured. Then you use JAXB to generate Java classes that represent the elements. Then you can Marshal and Unmarshal XML/Data into and out of those objects.
Example of the XSD