In my XML there's a tag with an attribute which has a name with a colon in it:
<GGS:bericht StUF:bestandsnaam="bestand.txt" >
I've tried all these combinations to try and return the value of this attribute:
parser.getAttributeValue(null, "StUF:bestandsnaam");
parser.getAttributeValue("StUF", "bestandsnaam");
parser.getAttributeValue(null, "bestandsnaam");
parser.getAttributeValue("bestandsnaam", "StUF");
... but they all return null.
If I manually remove the "StUF:" part of the attribute name, it works by calling:
parser.getAttributeValue(null, "bestandsnaam");
So how do you get the value of such an attribute? Without using the int-parameter version of getAttributeValue(), that is.
The "name with a colon in it" means the attribute is in a namespace. Somewhere further up in the XML document you should find a namespace declaration on one of the ancestors of this element that looks like
and it's this
{something}
(which will probably look like either an HTTP URL or aurn:...
) that you need to pass as the "namespace" parameter. For example, if you had:then the code would need to be