Java 8 XMLFilter - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 XMLFilter class.

This code example shows how to use the following methods:setParent, parse, setContentHandler
 
            final XMLReader xmlReader = createReader();
 
            final XMLFilter yaletFilter = yaletSupport.createFilter(request, response);
 
            yaletFilter.setParent(xmlReader);
 
            final ByteArrayOutputStream stream = new ByteArrayOutputStream(INITIAL_SIZE);
            try { 
                Transformer transformer = null;
                if (request.needTransform()) {
                    transformer = createTransformer(realPath);
                } 
                if (transformer != null) {
                    response.setContentType(TEXT_HTML);
                    final SAXSource saxSource = new SAXSource(yaletFilter, inputSource);
                    transformer.transform(saxSource, new StreamResult(stream));
                } else { 
                    response.setContentType(TEXT_XML);
                    yaletFilter.setContentHandler(new MyXMLSerializer(stream));

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setContentHandler
                return false; 
            } 
        }); 
 
        XMLFilter xmlFilter = new NoSourceAndNamespaceFilter(parser.getXMLReader());
        xmlFilter.setContentHandler(unmarshaller.getUnmarshallerHandler());
 
        SAXSource source = new SAXSource(xmlFilter, inputSource);
 
        return (Features)unmarshaller.unmarshal(source);
         
        } catch (ParserConfigurationException e) {
            throw new RuntimeException(e);
        } catch (JAXBException e) {
            throw new RuntimeException(e);
        } catch (SAXException e) {
            throw new RuntimeException(e);
        } 
    } 
 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setParent, parse, setContentHandler
     
      // xmlFilter2 uses xmlFilter1 as its reader. 
      xmlFilter2.setParent(xmlFilter1);
     
      // xmlFilter3 uses xmlFilter2 as its reader. 
      xmlFilter3.setParent(xmlFilter2);
     
      // xmlFilter3 outputs SAX events to the serializer. 
      java.util.Properties xmlProps = OutputPropertiesFactory.getDefaultMethodProperties("xml");
      xmlProps.setProperty("indent", "yes");
      xmlProps.setProperty("standalone", "no"); 
      Serializer serializer = SerializerFactory.getSerializer(xmlProps);                      
      serializer.setOutputStream(System.out);
      xmlFilter3.setContentHandler(serializer.asContentHandler());
 
  	  // Perform the series of transformations as follows: 
	    //   - transformer3 gets its parent (transformer2) as the XMLReader/XMLFilter 
	    //     and calls transformer2.parse(new InputSource("foo.xml")). 
      //   - transformer2 gets its parent (transformer1) as the XMLReader/XMLFilter 
	    //     and calls transformer1.parse(new InputSource("foo.xml")).  

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setParent
     * returns a new XMLReader for parsing and validating the input 
     */ 
    public XMLReader getXMLReader() throws SAXException
    { 
        XMLFilter filter = _Verifier.getVerifierFilter();
        filter.setParent(_WrappedParser.getXMLReader());
        return filter;
    } 
 
    /** 
     * @see SAXParser#isNamespaceAware() 
     */ 
    public boolean isNamespaceAware() 
    { 
        return _WrappedParser.isNamespaceAware();
    } 
 
    /** 
     * returns true always 
     */ 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setParent, parse
            SAXParserFactory aParserFactory = SAXParserFactory.newInstance();
            aParserFactory.setNamespaceAware(true);
            aParser = aParserFactory.newSAXParser();
 
            XMLFilter aFilter =  new MetaFilter(aLogger,null);
            aFilter.setParent( aParser.getXMLReader() ) ;
 
            aFilter.parse(new InputSource(aInStream));
        } 
        catch( javax.xml.parsers.ParserConfigurationException e )
        { 
            throw new ODFValidatorException( e );
        } 
        catch( org.xml.sax.SAXException e )
        { 
            throw new ODFValidatorException( e );
        } 
    } 
 
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setParent
    this.manager = manager;
  } 
 
  public XMLHandler(ImportManager manager, XMLFilter filter) throws SAXException
  { 
    filter.setParent(this.createReader());
    reader = filter;
 
    reader.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true);
    reader.setFeature(VALIDATION_FEATURE_ID, true);
    reader.setEntityResolver(new RunwayClasspathEntityResolver());
 
    // Root Handler 
    this.previousHandler = null;
    this.manager = manager;
  } 
 
  protected XMLHandler() 
  { 
 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setParent
            // Wire the output of the reader to filter1 
            // and the output of filter1 to filter2 
            // --A filter is a kind of reader 
            // --Setting the parent sets the input reader 
            // --Since a filter is a reader, the "parent" could be another filter 
            filter1.setParent(reader);
            filter2.setParent(filter1);
 
            // Set up the output stream 
            StreamResult result = new StreamResult(System.out);
 
            // Set up the transformer to process the SAX events generated 
            // by the last filter in the chain 
            Transformer transformer = stf.newTransformer();
            SAXSource transformSource = new SAXSource(filter2, input);
            transformer.transform(transformSource, result);
        } catch (TransformerConfigurationException tce) {
            // Error generated by the parser 
            System.out.println("\n** Transformer Factory error");
            System.out.println("   " + tce.getMessage());
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setParent
     * returns a new XMLReader for parsing and validating the input 
     */ 
    public XMLReader getXMLReader() throws SAXException
    { 
        XMLFilter filter = _Verifier.getVerifierFilter();
        filter.setParent(_WrappedParser.getXMLReader());
        return filter;
    } 
 
    /** 
     * @see SAXParser#isNamespaceAware() 
     */ 
    public boolean isNamespaceAware() 
    { 
        return _WrappedParser.isNamespaceAware();
    } 
 
    public boolean isValidating() 
    { 
        return _WrappedParser.isValidating();
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setParent
     * returns a new XMLReader for parsing and validating the input 
     */ 
    public XMLReader getXMLReader() throws SAXExceptionXMLFilter filter = _Verifier.getVerifierFilter();
        filter.setParent(_WrappedParser.getXMLReader());
        return filter;
    } 
 
    /** 
     * @see SAXParser#isNamespaceAware() 
     */ 
    public boolean isNamespaceAware() 
    { 
        return _WrappedParser.isNamespaceAware();
    } 
 
    /** 
     * returns true always 
     */ 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setContentHandler
                return false; 
            } 
        }); 
 
        XMLFilter xmlFilter = new NoSourceAndNamespaceFilter(parser.getXMLReader());
        xmlFilter.setContentHandler(unmarshaller.getUnmarshallerHandler());
 
        SAXSource source = new SAXSource(xmlFilter, inputSource);
 
        return (Features)unmarshaller.unmarshal(source);
         
        } catch (ParserConfigurationException e) {
            throw new RuntimeException(e);
        } catch (JAXBException e) {
            throw new RuntimeException(e);
        } catch (SAXException e) {
            throw new RuntimeException(e);
        } 
    } 
 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Java 8 XMLFilter Methods: