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; }
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); }
public void parse(String systemId) throws SAXException, IOException { if (fSAXParser != null && fSAXParser.fSchemaValidator != null) { if (fSAXParser.fSchemaValidationManager != null) { fSAXParser.fSchemaValidationManager.reset(); fSAXParser.fUnparsedEntityHandler.reset(); } resetSchemaValidator(); } super.parse(systemId); }
public void parse(InputSource inputSource) throws SAXException, IOException { if (fSAXParser != null && fSAXParser.fSchemaValidator != null) { if (fSAXParser.fSchemaValidationManager != null) { fSAXParser.fSchemaValidationManager.reset(); fSAXParser.fUnparsedEntityHandler.reset(); } resetSchemaValidator(); } super.parse(inputSource); }
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(); }
/** * 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(); }
synchronized public void parse(InputSource input, String base) throws IOException, SAXException { // Make sure we have a sane state for // Namespace processing. initParse(base,""); SAX2RDF.installHandlers(saxParser, this); saxParser.reset(); initEncodingChecks(input); try { saxParser.parse(input); } catch (UTFDataFormatException e) { generalError(ERR_UTF_ENCODING, e); } catch (IOException e) { generalError(ERR_GENERIC_IO, e); } catch (WrappedException wrapped) { wrapped.throwMe(); } catch (FatalParsingErrorException e) { // ignore this. } finally { afterParse(); } }