java - Retrieve data being parsed by SAXParser on runtime -
i have method parse xml data inputstream
public static void parsexml(inputstream stream, defaulthandler handler) { try { saxparserfactory factory = saxparserfactory.newinstance(); factory.setvalidating(false); saxparser parser = factory.newsaxparser(); parser.parse(stream, handler); } catch (parserconfigurationexception pce) { // code here } catch (saxparseexception spe) { // if exception caught, log current data being parsed saxparser here } catch (saxexception se) { // if exception caught, log current data being parsed saxparser here } catch (ioexception ie) { // code here } }
is there anyway log data being parsed saxparser whenever saxparseexception/saxexception caught?
Comments
Post a Comment