I have an variable which contains this value
<NewDataSet> <Table> <AirportCode>LKO</AirportCode> <CityOrAirportName>LUCKNOW AMAUSI</CityOrAirportName> <Country>India</Country> <CountryAbbrviation>IN</CountryAbbrviation> <CountryCode>733</CountryCode> <GMTOffset>-5.5</GMTOffset> <RunwayLengthFeet>7835</RunwayLengthFeet>
How can I extract the country code from this, in this case 733. Country code can be different, so I need to somehow get the value which is next to <CountryCode>
and before </CountryCode>
You should use Java DOM parser combined with Xpath. With that you can not only get country code but also other values from your xml like Airport code, CityAirportName etc. For examples of the code look at this site: https://www.tutorialspoint.com/java_xml/java_xpath_parse_document.htm