I have a suggestion to help resolve this issue. Use a customized MXParser:
import java.io.IOException;
import org.xmlpull.mxp1.MXParser;
import org.xmlpull.v1.XmlPullParserException;
public class SmackXMLPuller extends MXParser {
private int depth = 0;
private static final long serialVersionUID = 1L;
@Override
public int next() throws XmlPullParserException, IOException {
int ret = super.next();
if (ret == START_TAG)
depth++;
if (ret == END_TAG)
depth--;
return ret;
}
@Override
public int nextTag() throws XmlPullParserException, IOException {
int ret = next();
if (ret == START_TAG || ret == END_TAG)
return ret;
throw new XmlPullParserException("The next tag was not a start or end tag.");
}
/**
- Get the current depth of the parser
- @return int
*/
public int getDepth() {
return depth;
}
}
I have a suggestion to help resolve this issue. Use a customized MXParser:
import java.io.IOException;
import org.xmlpull.mxp1.MXParser;
import org.xmlpull.v1.XmlPullParserException;
public class SmackXMLPuller extends MXParser {
private int depth = 0;
private static final long serialVersionUID = 1L;
@Override
public int next() throws XmlPullParserException, IOException { int ret = super.next(); if (ret == START_TAG) depth++; if (ret == END_TAG) depth--; return ret; }
@Override
public int nextTag() throws XmlPullParserException, IOException { int ret = next(); if (ret == START_TAG || ret == END_TAG) return ret; throw new XmlPullParserException("The next tag was not a start or end tag."); }
/**
*/
public int getDepth() { return depth; }
}