1

I'm use Naver coperation Map OpenAPI.

API is return XML value. so, i parsing xml but error occur.

please check this code.

response xml code

<geocode xmlns="naver:openapi"> <userquery> <![CDATA[ 서울중구태평로2가23 ]]> </userquery> <total>4</total> <item> <point> <x>126.9779131</x> <y>37.5646854</y> </point> <address>서울특별시 중구 태평로2가 23</address> <addrdetail> <sido> <![CDATA[ 서울특별시 ]]> <sigugun> <![CDATA[ 중구 ]]> <dongmyun> <![CDATA[ 태평로2가 ]]> <rest> <![CDATA[ 23 ]]> </rest> </dongmyun> </sigugun> </sido> </addrdetail> </item> </geocode> 

I parsing this xml code (HttpURLConnection)

is = con.getInputStream(); JAXBContext jaxbCtx = JAXBContext.newInstance(User.class); User user = (User) jaxbCtx.createUnmarshaller().unmarshal(is);

User Instance is

@XmlRootElement(name = "geocode") @XmlAccessorType(XmlAccessType.FIELD) public class User { private String geocode; private List<Item> item; private int errorCode; private int total; private String userquery; ...... 

and Error is occur

Exception in thread "main" javax.xml.bind.UnmarshalException: unexpected element (uri:"naver:openapi", local:"geocode"). Expected elements are <{}geocode>

what is problem??

0

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.