java - XmlPullParser can't find attribute with a colon in its name -
in xml there's tag attribute has name colon in it:
<ggs:bericht stuf:bestandsnaam="bestand.txt" > i've tried these combinations try , return value of attribute:
parser.getattributevalue(null, "stuf:bestandsnaam"); parser.getattributevalue("stuf", "bestandsnaam"); parser.getattributevalue(null, "bestandsnaam"); parser.getattributevalue("bestandsnaam", "stuf"); ... return null.
if manually remove "stuf:" part of attribute name, works calling:
parser.getattributevalue(null, "bestandsnaam"); so how value of such attribute? without using int-parameter version of getattributevalue(), is.
the "name colon in it" means attribute in namespace. somewhere further in xml document should find namespace declaration on 1 of ancestors of element looks like
xmlns:stuf="{something}" and it's {something} (which either http url or urn:...) need pass "namespace" parameter. example, if had:
<root xmlns:gss="urn:example:gss" xmlns:stuf="http://stuff.com/namespace"> <ggs:bericht stuf:bestandsnaam="bestand.txt" > then code need be
parser.getattributevalue("http://stuff.com/namespace", "bestandsnaam");
Comments
Post a Comment