Package org.apache.excalibur.xml.sax

Examples of org.apache.excalibur.xml.sax.SAXParser


                             ContentHandler handler)
    throws SAXException, IOException, ProcessingException {
        if (source instanceof XMLizable) {
            ((XMLizable) source).toSAX(handler);
        } else {
            SAXParser parser = null;
            try {
                parser = (SAXParser) manager.lookup(SAXParser.ROLE);
                parser.parse(getInputSource(source), handler);
            } catch (SourceException e) {
                throw SourceUtil.handle(e);
            } catch (ComponentException e) {
                throw new ProcessingException("Exception during parsing source.", e);
            } finally {
View Full Code Here


                             ContentHandler handler)
    throws SAXException, IOException, ProcessingException {
        if (source instanceof XMLizable) {
            ((XMLizable) source).toSAX(handler);
        } else {
            SAXParser parser = null;
            try {
                parser = (SAXParser) manager.lookup(SAXParser.ROLE);
                parser.parse(getInputSource(source), handler);
            } catch (SourceException e) {
                throw SourceUtil.handle(e);
            } catch (ServiceException e) {
                throw new ProcessingException("Exception during parsing source.", e);
            } finally {
View Full Code Here

        contextData = DOMUtil.createDocument();
        contextData.appendChild(contextData.createElementNS(null, "context"));

        Element root = contextData.getDocumentElement();

        SAXParser parser = null;
        try {
            parser = (SAXParser) manager.lookup( SAXParser.ROLE );
            this.buildParameterXML(root, parser);
        } catch (ServiceException ce) {
            throw new ProcessingException("Unable to lookup parser.", ce);
View Full Code Here

                    + this.method.getURI().toString() + "\" (status=" + status + ")");
        }
        InputStream response = this.method.getResponseBodyAsStream();

        /* Let's try to set up our InputSource from the response output stream and to parse it */
        SAXParser parser = null;
        try {
            InputSource inputSource = new InputSource(response);
            parser = (SAXParser) this.manager.lookup(SAXParser.ROLE);
            parser.parse(inputSource, super.xmlConsumer);
        } catch (ServiceException ex) {
            throw new ProcessingException("Unable to get parser", ex);
        } finally {
            this.manager.release(parser);
            this.method.releaseConnection();
View Full Code Here

        message = obj.sayHello();
      } else {
        message = obj.getResource(this.source);
      }
     
      SAXParser parser = null;
      parser = (SAXParser)this.manager.lookup(SAXParser.ROLE);
      InputSource inputSource = new InputSource(new StringReader(message));
      parser.parse(inputSource,super.xmlConsumer);
    } catch (NotBoundException nbe) {
      throw new ProcessingException("Error looking up the RMI application server",nbe);
    } catch (ComponentException ce) {
      throw new ProcessingException("Error obtaining a SAXParser",ce);
    }
View Full Code Here

            LuceneIndexContentHandler luceneIndexContentHandler)
             throws ProcessingException {

        InputStream is = null;
        InputSource in = null;
        SAXParser parser = null;

        try {
            is = contentURLConnection.getInputStream();
            in = new InputSource(is);

            // get an XML parser
            parser = (SAXParser) this.manager.lookup(SAXParser.ROLE);
            //reader.setErrorHandler(new CocoonErrorHandler());
            parser.parse(in, luceneIndexContentHandler);
            //
            // document is parsed
            //
        } catch (IOException ioe) {
            throw new ProcessingException("Cannot read!", ioe);
View Full Code Here

    }

    /* The Source interface methods. */

    public void toSAX(ContentHandler handler) throws SAXException {
        SAXParser parser = null;
        try {
            parser = (SAXParser) serviceManager.lookup(SAXParser.ROLE);
            InputSource source = getInputSource();
            parser.parse(source, handler);
        } catch (SAXException e) {
            throw e;
        } catch (Exception e) {
            throw new SAXException(e);
        } finally {
View Full Code Here

        if (xml_data == null) {
            throw new ProcessingException("request-attribute " +
                    parameter + " is null, no xml-data for processing");
        }

        SAXParser parser = null;
        try {
            String sXml = new String(xml_data);
            if (getLogger().isDebugEnabled()) {
                getLogger().debug("processing : " + sXml);
            }
            inputSource = new InputSource(new StringReader(sXml));

            if (getLogger().isDebugEnabled()) {
                getLogger().debug("processing request attribute ");
            }
            String charset = getCharacterEncoding(response, contentType);
            if (charset != null) {
                inputSource.setEncoding(charset);
            }
            parser = (SAXParser) this.manager.lookup(SAXParser.ROLE);
            parser.parse(inputSource, super.xmlConsumer);
        } catch (Exception e) {
            getLogger().error("Could not get parser", e);
            throw new ProcessingException("Exception in RequestAttributeGenerator.generate()", e);
        } finally {
            this.manager.release(parser);
View Full Code Here

        }
    }

    public static void includeInputSource(InputSource source, ComponentManager manager, ContentHandler contentHandler)
            throws RuntimeException {
        SAXParser parser = null;
        try {
            parser = (SAXParser)manager.lookup(SAXParser.ROLE);
            IncludeXMLConsumer consumer = new IncludeXMLConsumer(contentHandler);
            parser.parse(source, consumer, consumer);
        } catch (Exception e) {
            throw new CascadingRuntimeException("Could not include page", e);
        } finally {
            if (parser != null) {
                manager.release((Component)parser);
View Full Code Here

                                ContentHandler handler)
    throws SAXException, IOException, ProcessingException {
        if ( source instanceof XMLizable ) {
            ((XMLizable)source).toSAX( handler );
        } else {
            SAXParser parser = null;
            try {
                parser = (SAXParser) manager.lookup( SAXParser.ROLE);
                parser.parse( getInputSource( source ), handler );
            } catch (SourceException se) {
                throw SourceUtil.handle(se);
            } catch (ComponentException ce) {
                throw new ProcessingException("Exception during parsing source.", ce);
            } finally {
View Full Code Here

TOP

Related Classes of org.apache.excalibur.xml.sax.SAXParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.