private synchronized void writeToSAX(ContentHandler handler) { // nothing must go wrong with this parse... SAXParser parser = fGrammar.getSAXParser(); StringReader aReader = new StringReader(fData); InputSource aSource = new InputSource(aReader); parser.setContentHandler(handler); try { parser.parse(aSource); } catch (SAXException e) { // this should never happen! // REVISIT: what to do with this?; should really not // eat it... } catch (IOException i) { // ditto with above } // Release the reference to the user's ContentHandler. parser.setContentHandler(null); }
private GoHandler getGoResponse( InputStream inputStream ) throws IOException, SAXException { GoHandler goHandler = null; InputSource source = new InputSource( inputStream ); SAXParser parser = new SAXParser(); goHandler = new GoHandler(); parser.setContentHandler( goHandler ); try { parser.parse( source ); } catch( IOException e ) { throw e; } return goHandler; }
public void parse() throws SAXException, IOException { SAXParser parser = new SAXParser(); parser.setContentHandler(ch); //TODO: Make sure that the ContentHandler is "reset". parser.parse(getInputSource()); }
/** * Parses an instance documented defined by a sax input source. * <p> * The object returned from the parse is the object which has been bound to the root * element of the document. This method should only be called once for a single instance document. * </p> * * @return The object representation of the root element of the document. * * @throws IOException * @throws SAXException * @throws ParserConfigurationException */ public Object parse(InputSource source) throws IOException, SAXException, ParserConfigurationException { parser = parser(); parser.setContentHandler(handler); parser.setErrorHandler(handler); parser.parse(source); return handler.getValue(); }
private ARPFilter(SAXParser rdr, XMLPullParserConfiguration config) { super(rdr); pullParser = config; saxParser = rdr; rdr.setEntityResolver(this); rdr.setDTDHandler(this); rdr.setContentHandler(this); rdr.setErrorHandler(this); setErrorHandler(new DefaultErrorHandler()); }
/** * Parses an instance documented defined by a sax input source. * <p> * The object returned from the parse is the object which has been bound to the root * element of the document. This method should only be called once for a single instance document. * </p> * * @return The object representation of the root element of the document. * * @throws IOException * @throws SAXException * @throws ParserConfigurationException */ public Object parse(InputSource source) throws IOException, SAXException, ParserConfigurationException { parser = parser(); parser.setContentHandler( handler ); parser.setErrorHandler( handler ); parser.parse( source ); return handler.getValue(); }
/** * Parses an instance documented defined by a sax input source. * <p> * The object returned from the parse is the object which has been bound to the root * element of the document. This method should only be called once for a single instance document. * </p> * * @return The object representation of the root element of the document. * * @throws IOException * @throws SAXException * @throws ParserConfigurationException */ public Object parse(InputSource source) throws IOException, SAXException, ParserConfigurationException { parser = parser(); parser.setContentHandler(handler); parser.setErrorHandler(handler); parser.parse(source); return handler.getValue(); }
parser.setContentHandler(ser.asContentHandler());