Examples of newTransformerHandler()


Examples of javax.xml.transform.sax.SAXTransformerFactory.newTransformerHandler()

            if (document == null) {
                DOMResult domResult = new DOMResult();
                try {
                    XMLReader xmlReader = XMLReaderFactory.createXMLReader();
                    SAXTransformerFactory saxTransformerFactory = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
                    TransformerHandler transformerHandler = saxTransformerFactory.newTransformerHandler();
                    transformerHandler.setResult(domResult);
                    xmlReader.setContentHandler(new XIncludeHandler(transformerHandler, uriDocMap));
                    xmlReader.parse(url.toExternalForm());
                } catch (TransformerConfigurationException e) {
                    throw new SAXException(e);
View Full Code Here

Examples of javax.xml.transform.sax.SAXTransformerFactory.newTransformerHandler()

        }

        StreamResult streamResult = new StreamResult(os);
        final SAXTransformerFactory transformerFactory = (SAXTransformerFactory) SAXTransformerFactory.newInstance();

        TransformerHandler handler = transformerFactory.newTransformerHandler();
        Transformer serializer = handler.getTransformer();
        serializer.setOutputProperty(OutputKeys.ENCODING, SyncopeConstants.DEFAULT_ENCODING);
        serializer.setOutputProperty(OutputKeys.INDENT, "yes");
        handler.setResult(streamResult);
        handler.startDocument();
View Full Code Here

Examples of javax.xml.transform.sax.SAXTransformerFactory.newTransformerHandler()

             
              if (!useXSLTC)
                stf.setAttribute(org.apache.xalan.processor.TransformerFactoryImpl.FEATURE_INCREMENTAL,
                   Boolean.TRUE);
                
              TransformerHandler th = stf.newTransformerHandler(stylesheet);
             
              reader.setContentHandler(th);
              reader.setDTDHandler(th);
             
              if(th instanceof org.xml.sax.ErrorHandler)
View Full Code Here

Examples of javax.xml.transform.sax.SAXTransformerFactory.newTransformerHandler()

            SAXTransformerFactory f = (SAXTransformerFactory) SAXTransformerFactory.newInstance();

            ByteArrayOutputStream result = new ByteArrayOutputStream();
            StreamResult sr = new StreamResult(result);

            TransformerHandler handler = f.newTransformerHandler();
            Transformer t = handler.getTransformer();
            t.setOutputProperty(OutputKeys.INDENT, "yes");
            handler.setResult(sr);
            handler.startDocument();
            startElement(handler, TAG_RESOURCE);
View Full Code Here

Examples of javax.xml.transform.sax.SAXTransformerFactory.newTransformerHandler()

        xmlReader.setContentHandler(templatesHandler);
        InputSource inputSource = new InputSource(getXsltSource());
        xmlReader.parse(inputSource);

        // Create transformer handler
        final TransformerHandler handler = transformerFactory.newTransformerHandler(templatesHandler.getTemplates());

        return handler;
    }

    private Map<String, Object> getLogicSheetParameters() {
View Full Code Here

Examples of javax.xml.transform.sax.SAXTransformerFactory.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");
        }
    }
View Full Code Here

Examples of javax.xml.transform.sax.SAXTransformerFactory.newTransformerHandler()

  public XmlWriter(PrintWriter out) throws SAXException {
    try {
      StreamResult streamResult = new StreamResult(out);
      SAXTransformerFactory tf = (SAXTransformerFactory) TransformerFactory.newInstance();
      // SAX2.0 ContentHandler.
      hd = tf.newTransformerHandler();
      Transformer serializer = hd.getTransformer();
      serializer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
      // serializer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM,"users.dtd");
      serializer.setOutputProperty(OutputKeys.INDENT, "yes");
      hd.setResult(streamResult);
View Full Code Here

Examples of javax.xml.transform.sax.SAXTransformerFactory.newTransformerHandler()

    private static TransformerHandler getTransformerHandler(
            String method, String encoding)
            throws TransformerConfigurationException {
        SAXTransformerFactory factory = (SAXTransformerFactory)
                SAXTransformerFactory.newInstance();
        TransformerHandler handler = factory.newTransformerHandler();
        handler.getTransformer().setOutputProperty(OutputKeys.METHOD, method);
        handler.getTransformer().setOutputProperty(OutputKeys.INDENT, "yes");
        if (encoding != null) {
            handler.getTransformer().setOutputProperty(
                    OutputKeys.ENCODING, encoding);
View Full Code Here

Examples of javax.xml.transform.sax.SAXTransformerFactory.newTransformerHandler()

      //Get the Templates object from the ContentHandler.
      Templates templates = templatesHandler.getTemplates();
      // Create a ContentHandler to handle parsing of the XML source. 
      TransformerHandler handler
        = saxTFactory.newTransformerHandler(templates);
      // Reset the XMLReader's ContentHandler.
      reader.setContentHandler(handler)

      // Set the ContentHandler to also function as a LexicalHandler, which
      // includes "lexical" events (e.g., comments and CDATA).
View Full Code Here

Examples of javax.xml.transform.sax.SAXTransformerFactory.newTransformerHandler()

      TransformerHandler response = null;
      StreamResult requestResult = new StreamResult(responseBody);

      SAXTransformerFactory tf = (SAXTransformerFactory) TransformerFactory
          .newInstance();
      response = tf.newTransformerHandler();
      response.setResult(requestResult);
      response.startDocument();
      response.startElement("", "exception", "exception",
          new AttributesImpl());
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.