Package org.xml.sax.helpers

Examples of org.xml.sax.helpers.XMLFilterImpl


     *      This is a complete URL to be written inside <Adress> element of the EPR,
     *      such as "http://foo.bar/abc/def"
     */
    public @NotNull WSEndpointReference createWithAddress(@NotNull final String newAddress) {
        MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
        XMLFilterImpl filter = new XMLFilterImpl() {
            private boolean inAddress = false;
            @Override
            public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
                if (localName.equals("Address") && uri.equals(version.nsUri)) {
                    inAddress = true;
                }
                super.startElement(uri,localName,qName,atts);
            }

            @Override
            public void characters(char ch[], int start, int length) throws SAXException {
                if (!inAddress) {
                    super.characters(ch, start, length);
                }
            }

            @Override
            public void endElement(String uri, String localName, String qName) throws SAXException {
                if (inAddress) {
                    super.characters(newAddress.toCharArray(),0,newAddress.length());
                }
                inAddress = false;
                super.endElement(uri, localName, qName);
            }
        };
        filter.setContentHandler(xsb.createFromSAXBufferCreator());
        try {
            infoset.writeTo(filter,false);
        } catch (SAXException e) {
            throw new AssertionError(e); // impossible since we are writing from XSB to XSB.
        }
View Full Code Here


      } catch (XPathExpressionException e) {
        throw new SAXException(e);
      }
    }
    transformedInputSource = new InputSource();
    transformedXMLReader = new XMLFilterImpl(){
      public void parse(InputSource pInput) throws SAXException, IOException {
        new DOMSerializer().serialize(schema, this);
      }

      public void parse(String pSystemId) throws SAXException, IOException {
View Full Code Here

     * @return The preprocess filter
     */
    protected XMLFilter getPreprocessFilter(String filename,
                                            ProgrammingLanguage language)
    {
        return new XMLFilterImpl();
    }
View Full Code Here

        XMLReaderCreator xrc = new XMLReaderCreator() {
            public XMLReader createXMLReader() {

                // foreset parser cannot change the receivers while it's working,
                // so we need to have one XMLFilter that works as a buffer
                XMLFilter buffer = new XMLFilterImpl() {
                    public void parse(InputSource source) throws IOException, SAXException {
                        forest.createParser().parse( source, this, this, this );
                    }
                };
View Full Code Here

                s2d = new SAX2DOMEx();
            } catch (ParserConfigurationException e) {
                throw new AssertionError(e);    // impossible
            }

            XMLFilterImpl f = new XMLFilterImpl() {
                public void setDocumentLocator(Locator locator) {
                    super.setDocumentLocator(locator);
                    location = new LocatorImpl(locator);
                }
            };
            f.setContentHandler(s2d);

            setHandler(f);
        }
View Full Code Here

        handler = new WhitespaceStripper(handler,errorReceiver,entityResolver);
        handler = new VersionChecker(handler,errorReceiver,entityResolver);

        // insert the reference finder so that
        // included/imported schemas will be also parsed
        XMLFilterImpl f = logic.createExternalReferenceFinder(this);
        f.setContentHandler(handler);

        if(errorReceiver!=null)
            f.setErrorHandler(errorReceiver);
        if(entityResolver!=null)
            f.setEntityResolver(entityResolver);

        return f;
    }
View Full Code Here

    /**
     * Creates a {@link SAXSource} that, when parsed, reads from this {@link DOMForest}
     * (instead of parsing the original source identified by the system ID.)
     */
    public @NotNull SAXSource createSAXSource(String systemId) {
        ContentHandlerNamespacePrefixAdapter reader = new ContentHandlerNamespacePrefixAdapter(new XMLFilterImpl() {
            // XMLReader that uses XMLParser to parse. We need to use XMLFilter to indrect
            // handlers, since SAX allows handlers to be changed while parsing.
            public void parse(InputSource input) throws SAXException, IOException {
                createParser().parse(input, this, this, this);
            }
View Full Code Here

        handler = new WhitespaceStripper(handler, errorReceiver, options.entityResolver);
        handler = new VersionChecker(handler, errorReceiver, options.entityResolver);

        // insert the reference finder so that
        // included/imported schemas will be also parsed
        XMLFilterImpl f = logic.createExternalReferenceFinder(this);
        f.setContentHandler(handler);

        if (errorReceiver != null)
            f.setErrorHandler(errorReceiver);
        if (options.entityResolver != null)
            f.setEntityResolver(options.entityResolver);

        return f;
    }
View Full Code Here

        handler = new WhitespaceStripper(handler,errorReceiver,entityResolver);
        handler = new VersionChecker(handler,errorReceiver,entityResolver);

        // insert the reference finder so that
        // included/imported schemas will be also parsed
        XMLFilterImpl f = logic.createExternalReferenceFinder(this);
        f.setContentHandler(handler);

        if(errorReceiver!=null)
            f.setErrorHandler(errorReceiver);
        if(entityResolver!=null)
            f.setEntityResolver(entityResolver);

        return f;
    }
View Full Code Here

    /**
     * Creates a {@link SAXSource} that, when parsed, reads from this {@link DOMForest}
     * (instead of parsing the original source identified by the system ID.)
     */
    public @NotNull SAXSource createSAXSource(String systemId) {
        ContentHandlerNamespacePrefixAdapter reader = new ContentHandlerNamespacePrefixAdapter(new XMLFilterImpl() {
            // XMLReader that uses XMLParser to parse. We need to use XMLFilter to indrect
            // handlers, since SAX allows handlers to be changed while parsing.
            public void parse(InputSource input) throws SAXException, IOException {
                createParser().parse(input, this, this, this);
            }
View Full Code Here

TOP

Related Classes of org.xml.sax.helpers.XMLFilterImpl

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.