public StreamingParserHandler(Configuration config) { super(config); buffer = new Buffer(); }
public void endDocument() throws SAXException { super.endDocument(); buffer.close(); }
protected void endElementInternal(ElementHandler handler) { super.endElementInternal(handler); if (stream(handler)) { //throw value into buffer buffer.put(handler.getParseNode().getValue()); //remove this node from parse tree if (handler.getParentHandler() instanceof ElementHandler) { ElementHandler parent = (ElementHandler) handler .getParentHandler(); ((NodeImpl) parent.getParseNode()).removeChild(handler.getParseNode()); //parent.endChildHandler(handler); } } }
/** * Streams the parser to the next element in the instance document which * matches the xpath query specified in the contstructor. This method * returns null when there are no more objects to stream. * * @return The next object in the stream, or null if no such object is * available. */ public Object parse() { if (thread == null) { Runnable runnable = new Runnable() { public void run() { try { parser.parse(input, handler); } catch (Exception e) { //close the buffer handler.getBuffer().close(); throw new RuntimeException(e); } } ; }; thread = new Thread(runnable); thread.start(); } return handler.getBuffer().get(); } }
protected void endElementInternal(ElementHandler handler) { super.endElementInternal(handler); if (stream(handler)) { //throw value into buffer buffer.put(handler.getParseNode().getValue()); //remove this node from parse tree if (handler.getParentHandler() instanceof ElementHandler) { ElementHandler parent = (ElementHandler) handler .getParentHandler(); ((NodeImpl) parent.getParseNode()).removeChild(handler.getParseNode()); //parent.endChildHandler(handler); } } }
return handler.getBuffer().get();
public void run() { try { parser.parse(input, handler); } catch (Exception e) { //close the buffer handler.getBuffer().close(); throw new RuntimeException(e); } } ;
public StreamingParserHandler(Configuration config) { super(config); buffer = new Buffer(); }
protected void endElementInternal(ElementHandler handler) { super.endElementInternal(handler); if ( stream( handler ) ) { //throw value into buffer buffer.put(handler.getParseNode().getValue()); //remove this node from parse tree if (handler.getParentHandler() instanceof ElementHandler) { ElementHandler parent = (ElementHandler) handler .getParentHandler(); ((NodeImpl)parent.getParseNode()).removeChild( handler.getParseNode() ); //parent.endChildHandler(handler); } } }
/** * Streams the parser to the next element in the instance document which * matches the xpath query specified in the contstructor. This method * returns null when there are no more objects to stream. * * @return The next object in the stream, or null if no such object is * available. */ public Object parse() { if (thread == null) { Runnable runnable = new Runnable() { public void run() { try { parser.parse(input, handler); } catch (Exception e) { //close the buffer handler.getBuffer().close(); throw new RuntimeException(e); } } ; }; thread = new Thread(runnable); thread.start(); } return handler.getBuffer().get(); } }
public void endDocument() throws SAXException { super.endDocument(); buffer.close(); }
public StreamingParserHandler(Configuration config) { super(config); buffer = new Buffer(); }
public void run() { try { parser.parse(input, handler); } catch (Exception e) { //close the buffer handler.getBuffer().close(); throw new RuntimeException(e); } } ;
public void run() { try { parser.parse(input, handler); } catch (Exception e) { //close the buffer handler.getBuffer().close(); throw new RuntimeException(e); } } ;
public void endDocument() throws SAXException { super.endDocument(); buffer.close(); }