Examples of XMLFilter


Examples of org.xml.sax.XMLFilter

        // create an actual reader that will perfom the parsing
        XMLReader reader = createXMLReader(fragment);
        // create Filter that will fix up elements that are not associated
        // with a namespace.
        XMLFilter namespaceFilter =
                new NamespaceFilter(defaultNamespacePrefix,
                                    defaultNamespaceURI);
        namespaceFilter.setParent(reader);
        return namespaceFilter;
    }
View Full Code Here

Examples of org.xml.sax.XMLFilter

        String data = "<?xml version=\"1.0\"?>\n"
          + "<!DOCTYPE root [\n" +
                "  <!--comment-->\n  <!ELEMENT test (#PCDATA)>" +
            "\n  <!--comment-->\n]>"
          + "\n<test />\n"
        XMLFilter filter = new XMLFilterImpl();
        filter.setParent(XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser"));
        Document doc = (new Builder(filter)).build(data, null);
        String result = doc.toXML();
        assertEquals(data, result);   
       
   
View Full Code Here

Examples of org.xml.sax.XMLFilter

        String data = "<?xml version=\"1.0\"?>\n"
          + "<!DOCTYPE root [\n" +
                "  <?target data?>\n  <!ELEMENT test (#PCDATA)>" +
            "\n  <?target?>\n]>"
          + "\n<test />\n"
        XMLFilter filter = new XMLFilterImpl();
        filter.setParent(XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser"));
        Document doc = (new Builder(filter)).build(data, null);
        String result = doc.toXML();
        assertEquals(data, result);   
       
   
View Full Code Here

Examples of org.xml.sax.XMLFilter

        // Make sure we can count the actual numbers of elements etc. that
        // are created
        builder.setFactory(factory);

        // Count specific attributes and elements for some of the tests
        XMLFilter filter = new XMLFilterImpl() {
            public void startElement(String namespaceURI,
                                     String localName,
                                     String qName,
                                     Attributes attributes)
                throws SAXException {
View Full Code Here

Examples of org.xml.sax.XMLFilter

     */
    private Object id;

    // javadoc inherited
    public XMLFilter selectScriptFilter(String contentType) {
        XMLFilter filter = null;
        ScriptFilter scriptFilter = (ScriptFilter)scriptFilters.get(contentType);
        if (scriptFilter != null) {
            Class sfClass = scriptFilter.getScriptClass();
            if (sfClass != null) {
                try {
View Full Code Here

Examples of org.xml.sax.XMLFilter

        return (ProxyManager) proxyManagers.get(id);
    }

    // javadoc inherited
    public XMLFilter retrieveScriptFilter(String id, String contentType) {
        XMLFilter filter = null;
        ScriptModule module = (ScriptModule)scriptModules.get(id);
        if (module != null) {
            filter = module.selectScriptFilter(contentType);
        }
View Full Code Here

Examples of org.xml.sax.XMLFilter

     */
    private void consumeResponse(String redirectURL,
                                 InputStream response,
                                 String contentType)
            throws IOException, SAXException {
        XMLFilter responseFilter = retrieveResponseFilter(contentType);
        ContentConditioner conditioner =
                createContentConditioner(contentType, responseFilter);
        InputSource source = new InputSource(response);

        String charEncoding;
View Full Code Here

Examples of org.xml.sax.XMLFilter

     * @param contentType The content type.
     */
    private XMLFilter retrieveResponseFilter(String contentType) {
        XMLPipelineContext context = getPipelineContext();
        Script script = (Script) context.getProperty(Script.class);
        XMLFilter responseFilter = null;
        if (script != null) {
            responseFilter =
                    configuration.retrieveScriptFilter(script.getRef(),
                                                       contentType);
        } else {
View Full Code Here

Examples of org.xml.sax.XMLFilter

        VolantisXMLReaderFactory readerFactory = new VolantisXMLReaderFactory();
        readerFactory.disableValidation();
        XMLReader reader = readerFactory.create();

        XMLFilter filter;


        filter = createFilter();
        if (filter != null) {
            filter.setParent(reader);
            reader = filter;

        }

        filter = new XMLFilterImpl() {

            public void startElement(
                    String uri, String localName, String qName, Attributes atts)
            throws SAXException {
                System.out.println("<" + qName + ">");
                super.startElement(uri, localName, qName, atts);
            }


            public void endElement(String uri, String localName, String qName)
            throws SAXException {
                System.out.println("</" + qName + ">");
                super.endElement(uri, localName, qName);
            }
        };
        filter.setParent(reader);
        reader = filter;

        reader.setContentHandler(new ValidatingHandler(validator,
                getSchemaNamespaces()));
       
View Full Code Here

Examples of org.xml.sax.XMLFilter

    // which is not guaranteed. I use a custom SAX Filter to
    // make sure the namespace declaration comes before the attribute.
    public void testAttributesVsNamespaces()
      throws ParsingException, IOException, SAXException {
         
       XMLFilter filter = new OrderingFilter();
       filter.setParent(
         XMLReaderFactory.createXMLReader(
           "org.apache.xerces.parsers.SAXParser"
         )
       );
       Builder builder = new Builder(filter);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.