0
다음 웹 서비스에서 설명, 공급 업체 및 가격을 얻고 싶습니다. [링크] http://sagt.vizushop.com/DefaultSimple.aspx?command=item_price&id=11Java의 웹 서비스 읽기
응답 I는 다음의 예로했지만, 그렇지
<item_details>
<description>
Jakl (Kumbuk) Center Table Timber : Mahogany/Rubber
</description>
<price>12600</price>
<vendor>BLUE</vendor>
</item_details>
다음과 같이 변수 NULL 값 작업-준다.
String vendor="";
String price="";
String description="";
try {
URL url = new URL("http://sagt.vizushop.com/DefaultSimple.aspx?command=item_price&id=11");
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new InputSource(url.openStream()));
doc.getDocumentElement().normalize();
NodeList nodeList = doc.getElementsByTagName("description");
//description=nodeList.item(0).getNodeValue();
Node node = nodeList.item(0);
description = node.getNodeValue();
Log.v(TAG, description);
}