Package javax.xml.transform

Examples of javax.xml.transform.TransformerFactory


            try
            {
                //this is a kind of commit, do it somewhere else
                try
                {
                    TransformerFactory tf = TransformerFactory.newInstance();
                    Transformer m = tf.newTransformer();
                    DOMSource source = new DOMSource((Document)conn);
                    FileOutputStream os = new FileOutputStream(file);
                    StreamResult result = new StreamResult(os);
                    m.setOutputProperty(OutputKeys.INDENT, "yes");
                    m.transform(source, result);
View Full Code Here


    }

    public boolean sendDocument(Document document) {
        try {
            //Get String from Document
            TransformerFactory factory = TransformerFactory.newInstance();
            Transformer transformer = factory.newTransformer();
            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
            transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
            StringWriter sw = new StringWriter();
            StreamResult result = new StreamResult(sw);
            DOMSource source = new DOMSource(document);
View Full Code Here

        {
            DOMSource source = new DOMSource(_cipangoConfig);

            CharArrayWriter writer = new CharArrayWriter();
            StreamResult result = new StreamResult(writer);
            TransformerFactory factory = TransformerFactory.newInstance();
            Transformer transformer = factory.newTransformer();
            transformer.transform(source, result);
            String _xmlConfigString = writer.toString();

            // get rid of the first line, as this will be prepended by
            // the XmlConfiguration
View Full Code Here

   *
   * @throws NoImplementationException
   *           If the underlying XML Transformer doesn't support SAXTransformer.
   */
  public ObjectTransformerImpl() throws NoImplementationException {
    TransformerFactory transFact = TransformerFactory.newInstance();
    if (transFact.getFeature(SAXTransformerFactory.FEATURE)) {
      _saxTransFact = (SAXTransformerFactory) transFact;
    } else {
      Log.error("SAXTransformerFactory is not supported.");
      throw new NoImplementationException(
          "SAXTransformerFactory is not supported.");
View Full Code Here

  {
    try
    {
      ByteArrayOutputStream os = new ByteArrayOutputStream();
      StreamResult result = new StreamResult(os);
      TransformerFactory factory = TransformerFactory.newInstance();
      DocumentBuilderFactory documentBuilderFactory =
        DocumentBuilderFactory.newInstance();
      DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
      //documentBuilder.setEntityResolver(new EasipEntityResolver());
     
      Node doc = documentBuilder.parse(new ByteArrayInputStream(source));
     
      Transformer transformer = factory.newTransformer(
          new StreamSource(getClass().getResourceAsStream("dataToSvg.xsl")));
      transformer.transform(new DOMSource(doc), result);
      return os.toByteArray();
    }
    catch (Throwable e)
View Full Code Here

    try {
      PageContextImpl pageContext = (PageContextImpl) this.pageContext;
     
      JspWriter out = pageContext.getOut();

      TransformerFactory factory = TransformerFactory.newInstance();

      String xsltSystemId = getCanonicalURL(pageContext, _xsltSystemId);
     
      Source source = getSource(_xslt, xsltSystemId);

      Transformer transformer = factory.newTransformer(source);
      // transformer.setOutputProperty("omit-xml-declaration", "yes");

      for (int i = 0; i < _paramNames.size(); i++) {
        String name = _paramNames.get(i);
        String value = _paramValues.get(i);
View Full Code Here

       
        //Path path = Vfs.lookup(href);
        try {
          //ReadStream sis = path.openReadAndSaveBuffer();

          TransformerFactory factory;
         
          if (_chainingType.equals("x-application/stylescript"))
            factory = new StyleScript();
          else {
            factory = TransformerFactory.newInstance();
          }

          if (factory instanceof AbstractStylesheetFactory)
            ((AbstractStylesheetFactory) factory).setStylePath(_stylePath);

          Path path = null;

          if (href.startsWith("/"))
            path = Vfs.getPwd().lookup(_application.getRealPath(href));
          else {
            String servletPath = RequestAdapter.getPageServletPath(req);

            Path pwd = Vfs.getPwd();
            pwd = pwd.lookup(_application.getRealPath(servletPath));
            path = pwd.getParent().lookup(href);
          }

          if (! path.canRead()) {
            Thread thread = Thread.currentThread();
            ClassLoader loader = thread.getContextClassLoader();

            URL url = loader.getResource(href);

            if (url != null) {
              Path newPath = Vfs.getPwd().lookup(url.toString());
              if (newPath.canRead())
                path = newPath;
            }
          }

          Source source;
          if (path.canRead())
            source = new StreamSource(path.getURL());
          else
            source = new StreamSource(href);

          if (log.isLoggable(Level.FINE))
            log.fine(L.l("'{0}' XSLT filter using stylesheet {1}",
                         req.getRequestURI(), source.getSystemId()));

          stylesheet = factory.newTemplates(source);
        } finally {
          // is.close();
        }
       
        Transformer transformer = null;
View Full Code Here

      PageContextImpl pageContext = (PageContextImpl) this.pageContext;
      ELContext env = pageContext.getELContext();
     
      JspWriter out = pageContext.getOut();

      TransformerFactory factory = TransformerFactory.newInstance();

      Source source = getSource(_xslt, _xsltSystemId);

      Transformer transformer = factory.newTransformer(source);

      for (int i = 0; i < _paramNames.size(); i++) {
        String name = _paramNames.get(i);
        String value = _paramValues.get(i);
View Full Code Here

  private static Transformer getTransformer()
    throws TransformerException
  {
    if (_transformer == null) {
      TransformerFactory factory = TransformerFactory.newInstance();
      _transformer = factory.newTransformer();
    }

    return _transformer;
  }
View Full Code Here

        StreamSource xmlStreamSource = new StreamSource(xmlFileReader);

        FileWriter outFileWriter = new FileWriter(outFile);
        StreamResult outStreamResult = new StreamResult(outFileWriter);

        TransformerFactory transformerFactory = TransformerFactory.newInstance();
        Transformer transformer = transformerFactory.newTransformer(xslStreamSource);

        transformer.transform(xmlStreamSource, outStreamResult);
        outFileWriter.flush();
    }
View Full Code Here

TOP

Related Classes of javax.xml.transform.TransformerFactory

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.