The KXmlParser class uses RuntimeExceptions when XmlPullParser doesn't declare a checked exception. This design choice is expected.
However, the class throws the top level RuntimeException (lines: 169, 180, 1130) instead of a more specific exception, which 'forces' clients to catch a RuntimeException, hiding the ability to detect errors from other parts of the code in the process.
One simple solution could be to throw a more specific KXmlParserRuntimeException to allow clients to catch only the errors thrown by the parser class. This would be backwards compatible with any client already catching the RuntimeException.
The KXmlParser class uses RuntimeExceptions when XmlPullParser doesn't declare a checked exception. This design choice is expected.
However, the class throws the top level RuntimeException (lines: 169, 180, 1130) instead of a more specific exception, which 'forces' clients to catch a RuntimeException, hiding the ability to detect errors from other parts of the code in the process.
One simple solution could be to throw a more specific KXmlParserRuntimeException to allow clients to catch only the errors thrown by the parser class. This would be backwards compatible with any client already catching the RuntimeException.