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