Package javax.xml.transform

Examples of javax.xml.transform.Source


    return sw.getBuffer().toString();
  }

  public static void toString(Document doc, String encoding, Writer w, boolean indent) throws TransformerFactoryConfigurationError, TransformerException {
    Source source = new DOMSource(doc);
    Result result = new StreamResult(w);

    Transformer xformer = TransformerFactory.newInstance().newTransformer();
    xformer.setOutputProperty(OutputKeys.ENCODING, encoding);
View Full Code Here


    return element;
  }

  public static void writeXmlFile(Document doc, File file, boolean indent, String encoding) throws TransformerFactoryConfigurationError, TransformerException {
    // Prepare the DOM document for writing
    Source source = new DOMSource(doc);

    // Prepare the output file
    Result result = new StreamResult(file);

    Transformer xformer = TransformerFactory.newInstance().newTransformer();
View Full Code Here

  }

  public static void writeXmlFile(Document doc, File file, Entry<String,String>... outputKeys) throws TransformerFactoryConfigurationError, TransformerException {
    // Prepare the DOM document for writing
    Source source = new DOMSource(doc);

    // Prepare the output file
    Result result = new StreamResult(file);

    // Write the DOM document to the file
View Full Code Here

    protected DynamicQueryContext createDynamicContext(Exchange exchange) throws Exception {
        Configuration config = getConfiguration();
        DynamicQueryContext dynamicQueryContext = new DynamicQueryContext(config);

        Message in = exchange.getIn();
        Source source = null;
        try {
            Item item = in.getBody(Item.class);
            dynamicQueryContext.setContextItem(item);
        } catch (NoTypeConversionAvailableException e) {
            try {
View Full Code Here

        int outRepresentation = getRepresentation(args[1]);

        InputStream is = System.in;
        OutputStream os = new BufferedOutputStream(System.out);

        Source xslt = null;
        // boolean computeMax = true;

        for (int i = 2; i < args.length; i++) {
            if ("-in".equals(args[i])) {
                is = new FileInputStream(args[++i]);
View Full Code Here

            Class<T> sourceClass) throws SQLException {

        checkClosed();
        checkReadable();

        final Source source = getSourceImpl(sourceClass);

        setReadable(false);
        setWritable(false);

        return (T) source;
View Full Code Here

   
   
    StreamSource stream = new StreamSource(inputFile);
   
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Source stylesheet = tFactory.getAssociatedStylesheet(stream, null, null, null);
   
    if ( stylesheet == null throw (new Exception("SOSXMLTransformer: no stylesheet found in input file." ));
   
    Transformer transformer = tFactory.newTransformer(stylesheet);
    addParameters(transformer, parameters);
View Full Code Here

    if ( !inputFile.exists() )  throw (new Exception("SOSXMLTransformer: no file found containing xml document." ));
   
    StreamSource stream = new StreamSource(inputFile);
   
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Source stylesheet = tFactory.getAssociatedStylesheet(stream, null, null, null);
   
    if ( stylesheet == null throw (new Exception("SOSXMLTransformer: no stylesheet found in input file." ));
   
    Transformer transformer = tFactory.newTransformer(stylesheet);
    addParameters(transformer, parameters);
View Full Code Here

    int c;
    while ((c = in.read()) != -1) {
      bAOS.write((char) c);
    }
    ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bAOS.toByteArray());
    Source stylesheet = tFactory.getAssociatedStylesheet(new StreamSource(byteArrayInputStream)
        , null, null, null);
   
    if ( stylesheet == null throw (new Exception("SOSXMLTransformer: no stylesheet found in input file." ));
   
    Transformer transformer = tFactory.newTransformer(stylesheet);
View Full Code Here

                throw new ServletException("Cannot find stylesheet: "
                        + xsltStyleSheet);
            }
            try {
                TransformerFactory tfactory = TransformerFactory.newInstance();
                Source xslSource = new StreamSource(is);
                // 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: "
                        + xsltStyleSheet, tce);
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.