Package javax.xml.transform

Examples of javax.xml.transform.Source


            response.setCharacterEncoding(preferredEncoding);
        }

        // Create the trasformation source using our custom ObjectInputSource
        InputSource inputSource = new ObjectInputSource(object);
        Source source = new SAXSource(saxReader, inputSource);

        // Create the trasformation result
        // Result result = new StreamResult(response.getWriter());
        Result result = new StreamResult(response.getOutputStream());
View Full Code Here


        t.setOutputProperty(OutputKeys.ENCODING, response
                .getCharacterEncoding());

        // Create the trasformation source using our custom ObjectInputSource
        InputSource inputSource = new ObjectInputSource(object);
        Source source = new SAXSource(saxReader, inputSource);

        // Create the trasformation result
        // Result result = new StreamResult(response.getWriter());
        Result result = new StreamResult(response.getOutputStream());
View Full Code Here

            throw new ServletException("Cannot find stylesheet: " + xsltStyleSheet);
        }
       
        try {
            TransformerFactory tfactory = TransformerFactory.newInstance();
            Source xslSource = new StreamSource(is);
            if (xsltStyleSheet != null) {
                // Note that if we don't do this, relative URLs can not be
                // resolved correctly!
                xslSource.setSystemId(getServletContext().getRealPath(
                        xsltStyleSheet));
            }
            this.templates = tfactory.newTemplates(xslSource);
        } catch (TransformerConfigurationException tce) {
            throw new ServletException("Error parsing XSLT stylesheet: "
View Full Code Here

            throw new ServletException("Cannot find stylesheet: "
                    + xsltStyleSheet);
        }
        try {
            TransformerFactory tfactory = TransformerFactory.newInstance();
            Source xslSource = new StreamSource(is);
            if (xsltStyleSheet != null) {
                // Note that if we don't do this, relative URLs can not be
                // resolved correctly!
                xslSource.setSystemId(getServletContext().getRealPath(
                        xsltStyleSheet));
            }
            this.templates = tfactory.newTemplates(xslSource);
        } catch (TransformerConfigurationException tce) {
            throw new ServletException("Error parsing XSLT stylesheet: "
View Full Code Here

        InputSource inputSource = new ObjectInputSource(throwable);

        // Create the sax "parser".
        ObjectXMLReader saxReader = new ErrorRequestXMLReader();

        Source source = new SAXSource(saxReader, inputSource);

        // Create the trasformation result
        Result result = new StreamResult(response.getWriter());
        // Result result = new StreamResult(response.getOutputStream());
View Full Code Here

      try { writer.close(); } catch (Exception ignored) { }
    }
  }

  public static void writeDocumentToFile(final File outFile, final Document doc) {
    final Source source = new DOMSource(doc);
    final Result result = new StreamResult(outFile);

    // Write the DOM document to the file
    Transformer xformer;
    try {
View Full Code Here

      t.setOutputProperty(OutputKeys.INDENT, "yes");                            // insert newlines
      t.setOutputProperty(OutputKeys.METHOD, "xml");
      t.setOutputProperty(OutputKeys.VERSION, "1.0");
      t.setOutputProperty(OutputKeys.ENCODING, "utf-8");
      t.setOutputProperty(OutputKeys.STANDALONE, "yes");
      Source src  = new DOMSource(doc);
      File sysDir = new File(WebappHelper.getUserDataRoot(), SYSTEM_DIR);        // destination is .../olatdata/system/catalog.xml
      File f = new File(sysDir, XML_FILE);
      File o = new File(sysDir, XML_FILE + ".old");
      OutputStream os = new BufferedOutputStream(new FileOutputStream(o));
      try {
View Full Code Here

    TransformerFactory tfactory = TransformerFactory.newInstance();
    XMLReader reader;
    try {
      reader = XMLReaderFactory.createXMLReader();
      reader.setEntityResolver(er);
      Source xsltsource = new SAXSource(reader, new InputSource(new StringReader(replacedOutput)));
      this.transformer = tfactory.newTransformer(xsltsource);
    } catch (SAXException e) {
      throw new OLATRuntimeException("Could not initialize transformer!", e);
    } catch (TransformerConfigurationException e) {
      throw new OLATRuntimeException("Could not initialize transformer (wrong config)!", e);
View Full Code Here

        /*
        Text txt = doc.createTextNode("Invalid: \u000C./"+((char) 0)+"..");
        doc.getDocumentElement().appendChild(txt);
        */

        Source source = new DOMSource(doc);

        XMLInputFactory f = new com.ctc.wstx.stax.WstxInputFactory();
        //f.setProperty(XMLInputFactory2.P_INTERN_NAMES, Boolean.TRUE);
        System.out.println("DEBUG: factory, intern names = "+f.getProperty(XMLInputFactory2.P_INTERN_NAMES));

View Full Code Here

    public RuleExecutionSet createRuleExecutionSet(
            Element ruleExecutionSetElement, Map properties )
        throws RuleExecutionSetCreateException
    {
        // Prepare the DOM source
        Source source = new DOMSource( ruleExecutionSetElement );

        // Create a reader to handle the SAX events
        RuleSetReader reader;
        try
        {
View Full Code Here

TOP

Related Classes of javax.xml.transform.Source

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.