1
SAXParser로 XAPI XML을 구문 분석하려고합니다. 하지만 지금은 문제가 있습니다.SAX 파서 및 XAPI xml
<node id="24924135" lat="49.8800274" lon="8.6453740" version="12" timestamp="2012-05-25T15:13:47Z" changeset="11699394" uid="61927" user="AlexPleiner">
<tag k="addr:city" v="Darmstadt"/>
<tag k="addr:housenumber" v="41"/>
<tag k="addr:postcode" v="64293"/>
<tag k="addr:street" v="Kahlertstraße"/>
<tag k="amenity" v="pub"/>
<tag k="name" v="Kneipe 41"/>
<tag k="note" v="DaLUG Meeting (4st Friday of month 19:30)"/>
<tag k="smoking" v="no"/>
<tag k="website" v="http://www.kneipe41.de/"/>
<tag k="wheelchair" v="limited"/>
그리고 내 SAXParser를 코드의 조각 :
public void startElement(String uri, String localName, String qName,
Attributes atts) throws SAXException {
if (localName.equals("node")) {
// Neue Person erzeugen
poi = new POIS();
poi.setLat(Float.parseFloat(atts.getValue("lat")));
poi.setLon(Float.parseFloat(atts.getValue("lon")));
}
}
public void endElement(String uri, String localName, String qName) throws SAXException {
poi.setHouseNo(currentValue);
if (localName.equals("addr:street")) {
poi.setStreet(currentValue);
}
if (localName.equals("amenity")) {
poi.setType(currentValue);
}
}
위도와 경도 값하는 문제가 아니라,하지만 태그 상기 XML의 조각
우선 "꼬리표".
어떻게 "k"를 확인하고 v의 값을 얻을 수 있습니까?
누구나 아이디어가 있으십니까? :) 당신이보고에 관심이
thx 많이 :) 매우 사용하기 쉽습니다 ^^ – demonking