SAXTransformerFactory newTransformerHandler - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for SAXTransformerFactory newTransformerHandler method.

This code example shows how to use the following methods:setErrorListener, setURIResolver, newTransformerHandler
    { 
        if (_xalanFactory == null) {
            createXalanTransformerFactory(); 
        } 
	if (_errorlistener != null) {
	    _xalanFactory.setErrorListener(_errorlistener);	    
	} 
	if (_uriresolver != null) {
	    _xalanFactory.setURIResolver(_uriresolver);
	} 
	return _xalanFactory.newTransformerHandler(src); 
    } 
 
 
    /** 
     * Get a TransformerHandler object that can process SAX ContentHandler 
     * events based on a transformer specified by the stylesheet Source.  
     * Uses org.apache.xalan.xsltc.trax.TransformerFactory.  
     */ 
    public TransformerHandler newTransformerHandler(Templates templates) 
6
CodeRank
This code example shows how to use the following methods:newTransformerHandler
		parser = new Parser();
	} 
 
	@Override 
	public Node readXML(String uri) throws Exception {
		TransformerHandler handler = saxFactory.newTransformerHandler();
		DOMResult result = new DOMResult();
		handler.setResult(result);
		parser.setContentHandler(handler);
		parser.parse(getInputSource(uri));
		return result.getNode();
	} 
} 
5
CodeRank
This code example shows how to use the following methods:newTemplatesHandler, newTransformerHandler
This code example shows how to use the following methods:newTransformerHandler
        // rtfSample.write(System.out); 
 
        // Prepare a SAX content handler 
        SAXTransformerFactory factory = ((SAXTransformerFactory) TransformerFactory
                .newInstance());
        TransformerHandler transform = factory.newTransformerHandler();
        transform.setResult(new StreamResult(System.out));
 
        // Analyze the RTF representation 
        TikaRepresentation tr = new TikaRepresentation(rtfSample);
        tr.setTikaParser(new RTFParser());
        tr.parse(transform);
    } 
} 
5
CodeRank
This code example shows how to use the following methods:newTransformerHandler
    } 
 
    public TransformerHandler newTransformerHandler(Source src) throws TransformerConfigurationException {
        if (saxtual == null)
            throw new TransformerConfigurationException("Provider is not a SAXTransformerFactory");
        return saxtual.newTransformerHandler();
    } 
 
    public TransformerHandler newTransformerHandler(Templates templates) throws TransformerConfigurationException {
        if (saxtual == null)
            throw new TransformerConfigurationException("Provider is not a SAXTransformerFactory");
        return saxtual.newTransformerHandler(templates);
    } 
 
    public TransformerHandler newTransformerHandler() throws TransformerConfigurationException {
        if (saxtual == null)
            throw new TransformerConfigurationException("Provider is not a SAXTransformerFactory");
        return saxtual.newTransformerHandler();
    } 
 
3
CodeRank
This code example shows how to use the following methods:setErrorListener, setURIResolver, newTransformerHandler
    { 
        if (_xalanFactory == null) {
            createXalanTransformerFactory(); 
        } 
	if (_errorlistener != null) {
	    _xalanFactory.setErrorListener(_errorlistener);	    
	} 
	if (_uriresolver != null) {
	    _xalanFactory.setURIResolver(_uriresolver);
	} 
	return _xalanFactory.newTransformerHandler(); 
    } 
 
    /** 
     * Get a TransformerHandler object that can process SAX ContentHandler 
     * events based on a transformer specified by the stylesheet Source.  
     * Uses org.apache.xalan.processor.TransformerFactory.  
     */ 
    public TransformerHandler newTransformerHandler(Source src) 
	throws TransformerConfigurationException 
5
CodeRank
This code example shows how to use the following methods:newTransformerHandler
  } 
 
  @Override 
  public void writeTo(Writer writer) throws Exception {
    SAXTransformerFactory factory = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
    TransformerHandler handler = factory.newTransformerHandler();
    handler.getTransformer().setOutputProperty(OutputKeys.METHOD, "xml");
    handler.getTransformer().setOutputProperty(OutputKeys.ENCODING, "UTF-8");
    handler.getTransformer().setOutputProperty(OutputKeys.INDENT, "yes");
 
    // This is proprietary, so it's a best effort 
    handler.getTransformer().setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
 
    // 
    handler.setResult(new StreamResult(writer));
 
    // 
    docXML = new DocumentEmitter(handler, handler);
    docXML.comment("Node type generation prototype");
 
3
CodeRank
This code example shows how to use the following methods:newTransformerHandler
This code example shows how to use the following methods:newTransformerHandler
This code example shows how to use the following methods:newTransformerHandler
 
    public PlainXMLSerializer() throws TransformerConfigurationException {
        TransformerFactory factory = TransformerFactory.newInstance();
        if (factory.getFeature(SAXTransformerFactory.FEATURE)) {
            SAXTransformerFactory saxFactory = (SAXTransformerFactory) factory;
            this.handler = saxFactory.newTransformerHandler();
        } else { 
            throw new UnsupportedOperationException("compatibility error");
        } 
    } 
 
    public void setDocumentLocator(Locator locator) {
        handler.setDocumentLocator(locator);
    } 
 
    public void startDocument() throws SAXException {
        handler.startDocument();
    } 
 
    public void endDocument() throws SAXException {
3
CodeRank
newTransformerHandler Method Overview
Get a TransformerHandler object that can process SAX ContentHandler events into a Result.
See Code Examples for other Java 8 SAXTransformerFactory Methods: