내 XML은 다음과 같습니다안드로이드에서 SAX xml Parser로부터 속성 값을 얻는 방법?
<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns='http://www.w3.org/2005/Atom' xmlns:media='http://search.yahoo.com/mrss/'
xmlns:gd='http://schemas.google.com/g/2005' xmlns:yt='http://gdata.youtube.com/schemas/2007'>
<media:group>
<media:content
url='http://www.youtube.com/v/UBCNwgFlw1A?f=videos&app=youtube_gdata'
type='application/x-shockwave-flash' medium='video' isDefault='true'
expression='full' duration='217' yt:format='5' />
<media:content
url='rtsp://v4.cache7.c.youtube.com/CiILENy73wIaGQlQw2UBwo0QUBMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp'
type='video/3gpp' medium='video' expression='full' duration='217'
yt:format='1' />
<media:content
url='rtsp://v2.cache6.c.youtube.com/CiILENy73wIaGQlQw2UBwo0QUBMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp'
type='video/3gpp' medium='video' expression='full' duration='217'
yt:format='6' />
</media:group>
</entry>
된 .java 파일
public void startElement(String arg0, String localName, String arg2,
Attributes attributes) throws SAXException {
currentElement = true;
if (localName.equals("content")) {
String videourl = attributes.getValue("url");
Log.v("log_tag", "Video url is : " + videourl);
message.setVideourl(videourl);
String duration = attributes.getValue("duration");
Log.v("log_tag", "Duration of Video is : " + duration);
String formaturl1 = attributes.getValue("format");
Log.v("log_tag", "format of url is : " + formaturl);
}
}
내가 parser.and 내가 모든 미디어 Atrribute 얻을 수 있습니다 SAX를 사용 : 컨텐츠를. 하지만 yt : format value를 얻을 수 없기 때문에 Android에서 yt : format 값을 얻을 수 있습니다.
색소폰 [파서] (http://developerlife.com/tutorials/?p=29) – Uttam