2010-06-08 59 views
0

我有以下XML代碼,它是通過UPnP設備獲取的,並且喜歡獲取res值--RTSP URL。在這種情況下rtsp://10.42.0.103:554/live.sdp獲取XML值的Android

我該怎麼做?我聽說Android有一些內置的讀取XML支持。真的嗎?

<DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/"> 
<item id="11" parentID="1" restricted="1"> 
<dc:title>Network Camera Stream 1</dc:title> 
<upnp:class>object.item.videoItem</upnp:class> 
<res protocolInfo="rtsp-rtp-udp:*:video/mpeg4-generic:*" resolution="640x480">rtsp://10.42.0.103:554/live.sdp</res> 
</item> 
<item id="12" parentID="1" restricted="1"> 
<dc:title>Network Camera Stream 2</dc:title> 
<upnp:class>object.item.videoItem</upnp:class> 
<res protocolInfo="rtsp-rtp-udp:*:video/mpeg4-generic:*" resolution="176x144">rtsp://10.42.0.103:554/live2.sdp</res> 
</item> 
</DIDL-Lite> 

回答