IXmlPullParser.GetNamespaceCount(Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the numbers of elements in the namespace stack for the given depth.
[Android.Runtime.Register("getNamespaceCount", "(I)I", "GetGetNamespaceCount_IHandler:Org.XmlPull.V1.IXmlPullParserInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public int GetNamespaceCount(int depth);
[<Android.Runtime.Register("getNamespaceCount", "(I)I", "GetGetNamespaceCount_IHandler:Org.XmlPull.V1.IXmlPullParserInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member GetNamespaceCount : int -> int
Parameters
- depth
- Int32
The element depth whose cumulative namespace declaration count is required. Use Depth for the current element.
Returns
The cumulative number of entries in the namespace stack at depth, or 0 if namespace processing is disabled. The difference between the counts at the current depth and the previous depth is the number of declarations on the current element.
- Attributes
Exceptions
Remarks
Returns the numbers of elements in the namespace stack for the given depth. If namespaces are not enabled, 0 is returned.
<b>NOTE:</b> when parser is on END_TAG then it is allowed to call this function with getDepth()+1 argument to retrieve position of namespace prefixes and URIs that were declared on corresponding START_TAG.
<b>NOTE:</b> to retrieve list of namespaces declared in current element:
XmlPullParser pp = ...
int nsStart = pp.getNamespaceCount(pp.getDepth()-1);
int nsEnd = pp.getNamespaceCount(pp.getDepth());
for (int i = nsStart; i < nsEnd; i++) {
String prefix = pp.getNamespacePrefix(i);
String ns = pp.getNamespaceUri(i);
// ...
}
Java documentation for org.xmlpull.v1.XmlPullParser.getNamespaceCount(int).
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.