0
getAttributeValue()에서 null 값을 반환하는 이유를 모르겠습니다. XML 파일에서 일부 속성을 가져와야합니다. 도와주세요.xmlpullparser에서 null을 반환하는 속성
case XmlPullParser.END_TAG:
if (tagname.equalsIgnoreCase(KEY_MARKER)) {
stackSites.add(curStackSite);
} else if (tagname.equals(KEY_TITULO)) {
String title = xpp.getAttributeValue(null, "provincia");
if (title!=null){
curStackSite.setTitulo(title);
}else{
curStackSite.setTitulo("Es null");
}
xpp.nextTag();
} else if (tagname.equalsIgnoreCase(KEY_LINK)) {
curStackSite.setLink(curText);
}
break;
XML 파일
<?xml version="1.0" encoding="UTF-8"?>
<stack-sites>
<marker>
<titulo provincia="Pich">Pichincha</titulo>
<link>http://stackoverflow.com/</link>
<fecha>2014/08/12 14:57:59</fecha>
<image>https://dl.dropboxusercontent.com/u/5724095/XmlParseExample/stackoverflow.png</image>
<lat>-0.1</lat>
<lng>-78.46</lng>
<mag>4.1</mag>
<depth>5</depth>
</marker>
</stack-sites>
xml 파일을 게시 할 수 있습니까? – mmlooloo
@mmlooloo 내가 볼 수 있도록 xml 파일을 넣습니다. –
XML 파일에서 와 같이 변경했습니다. 많은 특성을 얻기 위해 무엇을해야합니까? 샘플 : –