Package org.xml.sax

Examples of org.xml.sax.XMLFilter


            pipelineContext.pushBaseURI(remappedURL);

                // Create a pipeline
                XMLPipeline pipeline = pipelineFactory.createPipeline
                    (pipelineContext);
            XMLFilter filter = pipelineFactory.createPipelineFilter(
                    pipeline, true);

            // Create a serializer that will output to the response.
            ServletOutputStream outputStream = httpResponse.getOutputStream();
            XMLSerializer serializer = getSerializer(outputStream);
            filter.setContentHandler(serializer.asContentHandler());

            // Create and initialise the request process.
            HTTPRequestOperationProcess requestOperation =
                    new HTTPRequestOperationProcess();
            requestOperation.setFollowRedirects(
View Full Code Here


                System.out.println(validationEvent);
                return false;
            }
        });

        XMLFilter xmlFilter = new NoSourceAndNamespaceFilter(parser.getXMLReader());
        xmlFilter.setContentHandler(unmarshaller.getUnmarshallerHandler());

        SAXSource source = new SAXSource(xmlFilter, inputSource);

        return (Features)unmarshaller.unmarshal(source);
       
View Full Code Here

            // If the Source object is not changed, the
            // getTransformerHandler() of XSLTProcessor will simply return
            // the old template object. If the Source is unchanged, the
            // namespaces are not modified either.
            XMLFilter saveNSFilter = new SaveNamespaceFilter(namespaceURIs);
            return xsltProcessor.getTransformerHandler(source, saveNSFilter);

        } catch (ServiceException e) {
            throw new ProcessingException("Could not obtain XSLT processor", e);
        } catch (MalformedURLException e) {
View Full Code Here

    private void writeSVGToOutput(SVGGraphics2D svgGenerator,
                                  Element svgRoot,
                                  TranscoderOutput output)
        throws TranscoderException {
        // XMLFilter
        XMLFilter xmlFilter = output.getXMLFilter();
        if(xmlFilter != null){
            handler.fatalError(new TranscoderException("" + ERROR_INCOMPATIBLE_OUTPUT_TYPE));
        }

        // <!> FIX ME: SHOULD HANDLE DOCUMENT INPUT
View Full Code Here

                Source reader = new StaxSource(StaxUtils.createXMLStreamReader(is));
                DOMResult dom = new DOMResult();
                t.newTransformer().transform(reader, dom);
                return unmarshaller.unmarshal(dom.getNode());
            }
            XMLFilter filter = null;
            try {
                filter = factory.newXMLFilter(t);
            } catch (TransformerConfigurationException ex) {
                TemplatesImpl ti = (TemplatesImpl)t;
                filter = factory.newXMLFilter(ti.getTemplates());
                trySettingProperties(filter, ti);
            }
            XMLReader reader = new StaxSource(StaxUtils.createXMLStreamReader(is));
            filter.setParent(reader);
            SAXSource source = new SAXSource();
            source.setXMLReader(filter);
            if (systemId != null) {
                source.setSystemId(systemId);
            }
View Full Code Here

                    && tFactory.getFeature(SAXResult.FEATURE)) {
                // Cast the TransformerFactory to SAXTransformerFactory.
                SAXTransformerFactory saxTFactory =
                    ((SAXTransformerFactory)tFactory);
                // Create an XMLFilter for each stylesheet.
                XMLFilter xmlfilter =
                    saxTFactory.newXMLFilter(new StreamSource(xsltfile));

                // Create an XMLReader.
                XMLReader parser = createParser();
                if (parser == null) {
                    throw new FOPException("Unable to create SAX parser");
                }

                // xmlFilter1 uses the XMLReader as its reader.
                xmlfilter.setParent(parser);
                return xmlfilter;
            } else {
                throw new FOPException("Your parser doesn't support the features SAXSource and SAXResult."
                                       + "\nMake sure you are using a xsl parser which supports TrAX");
            }
View Full Code Here

                 "http://www.w3.org/2001/XMLSchema", eh);
            maybeSetProperty
                (sp, "http://java.sun.com/xml/jaxp/properties/schemaSource",
                 schemaUris(), eh);
            SAXHandler sh = new SAXHandler ();
            XMLFilter filter = new XmlnsUrisPatcher ();
            filter.setParent(sp.getXMLReader());
            filter.setContentHandler(sh);
            filter.setDTDHandler(sh);
            filter.setEntityResolver(sh);
            filter.setErrorHandler(eh);
            // build Document
            filter.parse(toParse);
            doc = sh.getDocument();
            Element root = doc.getRootElement();
            if (root == null || !root.getName().equals ("Package")
          || !root.getNamespaceURI().equals (XPDLUtil.XPDL_NS)) {
          eh.add (new PrioritizedMessage
View Full Code Here

     *
     * @return The SAX XML filter.
     * @throws IOException
     */
    public XMLFilter getXmlFilter() throws IOException {
        XMLFilter result = null;
        final Templates templates = getTemplates();

        if (templates != null) {
            try {
                result = getSaxTransformerFactory().newXMLFilter(templates);
View Full Code Here

            // If the Source object is not changed, the
            // getTransformerHandler() of XSLTProcessor will simply return
            // the old template object. If the Source is unchanged, the
            // namespaces are not modified either.
            XMLFilter saveNSFilter = new SaveNamespaceFilter(namespaceURIs);
            return xsltProcessor.getTransformerHandler(source, saveNSFilter);

        } catch (ServiceException e) {
            throw new ProcessingException("Could not obtain XSLT processor", e);
        } catch (MalformedURLException e) {
View Full Code Here

   
    @Override
    protected Object unmarshalFromInputStream(Unmarshaller unmarshaller, InputStream is, MediaType mt)
        throws JAXBException {
        try {
            XMLFilter filter = factory.newXMLFilter(
                createTemplates(getInTemplates(mt), inParamsMap, inProperties));
            SAXSource source = new SAXSource(filter, new InputSource(is));
            if (systemId != null) {
                source.setSystemId(systemId);
            }
View Full Code Here

TOP

Related Classes of org.xml.sax.XMLFilter

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.