i am using StAX for processing huge xml file. as shown below in the code, in the switch-case there is a default condition. when i run the code the text in the default case prints the following:
unhandled case4
what is case4? i tried to java docs for Stax but i could not find it...it seems that XMLStreamConstants.START_ELEMENT has constant int value of 1 and XMLStreamConstants.END_ELEMENT has constant value of 2...but which one is 4?
code:
for (int event = mStAXParser.next(); event != XMLStreamConstants.END_DOCUMENT; event = mStAXParser.next()) {
switch (event) {
case XMLStreamConstants.START_ELEMENT:
Log.d(TAG, "main", "@START_ELEMENT");
Log.d(TAG, "main", "getLocalName(): "+mStAXParser.getLocalName());
Log.d(TAG, "main", "getAttributeCount(): "+mStAXParser.getAttributeCount());
Log.d(TAG, "main", "getAttributeLocalName(): "+mStAXParser.getAttributeLocalName(1));
Log.d(TAG, "main", "getAttributeValue(): "+mStAXParser.getAttributeValue(0));
break;
case XMLStreamConstants.END_ELEMENT:
Log.d(TAG, "main", "@END_ELEMENT");
Log.d(TAG, "main", "getLocalName():"+mStAXParser.getLocalName());
break;
default:
Log.wtf(TAG, "main", "unhandled case" + event);
}
}
See https://docs.oracle.com/javase/8/docs/api/constant-values.html#javax.xml.stream.XMLStreamConstants.CHARACTERS, it is characters which has the value 4
.