如何从服务器解析xml到我们的html页面中的phonegap应用程序

我是webdevelopment的新手,我想从网络服务器解析xml而不是从本地服务器解析它是怎么可能的.我尝试了很多googled.Please帮助我.我必须解析这个网址“http://twitter.com/statuses/ public_timeline.xml”

解决方法

你可以在 HTML页面中使用 JQuery( http://jquery.com/)插件作为脚本标记中的条目,称为jquery的ajax()函数来命中url,你可以使用jquery的parseXML()和find()函数来解析xml数据
像这样-

<html>
<head>
<script src="js/jquery-1.4.2.js" type="text/javascript" charset="utf-8"></script>
<script>
function onBodyLoad(){
$.ajax({  
    url:'http://twitter.com/statuses/public_timeline.xml',dataType:"xml",contentType:'application/xml',timeout:10000,type:'POST',success:function(data) {  

    alert(data);
    var xmlDoc = $.parseXML( data ),$xml = $( xmlDoc ),$title = $xml.find( "title" );

    /* append "RSS Title" to #someElement */
    $( "#someElement" ).append( $title.text() );

    /* change the title to "XML Title" */
    $title.text( "XML Title" );

    /* append "XML Title" to #anotherElement */
    $( "#anotherElement" ).append( $title.text() );

    },error:function(XMLHttpRequest,textStatus,errorThrown) {     
      alert("Error status :"+textStatus);  
      alert("Error type :"+errorThrown);  
      alert("Error message :"+XMLHttpRequest.responseXML);  
    }});
}
</script>
</head>
<body onload="onBodyLoad()">
<p id="someElement"></p>
<p id="anotherElement"></p>
</body>
</html>

相关文章

php输出xml格式字符串
J2ME Mobile 3D入门教程系列文章之一
XML轻松学习手册
XML入门的常见问题(一)
XML入门的常见问题(三)
XML轻松学习手册(2)XML概念