2013-04-27 3 views
4

자바에서 노드 값을 가져 오는 방법을 알아 내려고하고 있습니다. 나는 몇 가지 튜토리얼을 읽었습니다하지만 그들은 모두 훨씬 더 복잡 내가 뭘하는지보다 사용하는 예 ..자바로 XML 노드 값 가져 오기

은 여기 내 자바 스크립트

 if(xmlhttpp.readyState==4 && xmlhttpp.status==200){ 
      document.getElementById("ajax_status").innerHTML=xmlhttpp.responseXML.getElementsByTagName('status').nodeValue; 
     } 

의 그리고 XML은 ...입니다

<?xml version='1.0' encoding='UTF-8'?> 
<resp><fname>Kyla</fname> 
<lname>Bonds</lname> 
<addr>6916 S Elizabeth Street</addr> 
<city>Chicago</city> 
<street>IL</street> 
<zip>60636</zip> 
<phone></phone> 
<email>[email protected]</email> 
<status>Found user</status></resp> 

어떻게하면 "Found User"를 얻을 수 있습니까?

+0

그냥 작은 지점이 아닌 대답을 시도하지만, 객체는 일반적으로 XMLHTTP보다는 xmlhttpp로 언급 될 것이다. –

답변

6

는 질문에

xmlhttpp.responseXML.getElementsByTagName('status')[0].firstChild.nodeValue