Package javax.xml.transform.dom

Examples of javax.xml.transform.dom.DOMSource


    try {
      // Transform the DOM represent to text
      java.io.ByteArrayOutputStream xmlstr=
          new java.io.ByteArrayOutputStream();
       
      DOMSource source=new DOMSource();
      source.setNode(node);
     
      StreamResult result=new StreamResult(xmlstr);
     
      Transformer trans=
          TransformerFactory.newInstance().newTransformer();
View Full Code Here


     *         schema validators, etc.
     */
    public static Source asSource(OMNode node) {
        // Note: Once we depend on JDK 1.6, we could also use StAXSource from JAXP 1.4.
        if (node instanceof Node) {
            return new DOMSource((Node)node);
        } else {
            return ((OMContainer)node).getSAXSource(true);
        }
    }
View Full Code Here

        ByteArrayOutputStream baos = new ByteArrayOutputStream(2048);
        try {
            TransformerFactory tFactory = TransformerFactory.newInstance();
            Transformer transformer = tFactory.newTransformer();

            DOMSource source = new DOMSource(doc);
            StreamResult result = new StreamResult(baos);
            transformer.transform(source, result);
        } catch (TransformerException e) {
            throw new WsException("Error transforming WSDL: " + e.getMessage());
        }
View Full Code Here

      Writer writer = new PrintWriter(bout);

      MappedNamespaceConvention con = new MappedNamespaceConvention();
      XMLStreamWriter streamWriter = new ResultAdapter(con, writer);

      Source source = new DOMSource(root);
      //Result output = new StAXResult(streamWriter); JDK 6 only
      Result output = new SAXResult((ContentHandler)streamWriter);

      Transformer transformer = TransformerFactory.newInstance().newTransformer();
      transformer.transform(source, output);
View Full Code Here

            throws TransformerException {
        StringWriter writer = new StringWriter();

        TransformerFactory factory = TransformerFactory.newInstance();
        Transformer transformer = factory.newTransformer();
        transformer.transform(new DOMSource(doc), new StreamResult(writer));

        return writer.toString();
    }
View Full Code Here

      try {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        dbf.setNamespaceAware(true);
        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
              Node doc = docBuilder.parse(new InputSource(getBinaryStream()));
              return (T) new DOMSource(doc);
      } catch (ParserConfigurationException e) {
        throw new SQLException(e);
      } catch (SAXException e) {
        throw new SQLException(e);
      } catch (IOException e) {
View Full Code Here

    }
   
    TransformerFactory transformerFactory = TransformerFactory.newInstance();
    Transformer transformer = transformerFactory.newTransformer();
    transformer.setOutputProperty(OutputKeys.INDENT, "yes");
    transformer.transform(new DOMSource(tld), new StreamResult(targetFile));
  }
View Full Code Here

         Transformer transformer = TransformerFactory.newInstance().newTransformer();
         transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");

         for (Element element : extraMarkupHeaders)
         {
            DOMSource source = new DOMSource(element);
            StreamResult result = new StreamResult(new StringWriter());

            // we want to ouput xhtml text that will still work on html browsers.
            // In order to do this we need to have the script tag be not self closing
            // which it will try and do with the xml or xhtml method. If we just use
View Full Code Here

      browse(node);
    }

    Transformer transformer =
      TransformerFactory.newInstance().newTransformer();
    Source source = new DOMSource(doc);

    CharArrayWriter writer = new CharArrayWriter();
    Result output = new StreamResult(writer);
    transformer.transform(source, output);
    writer.flush();
View Full Code Here

        try {
            TransformerFactory factory = TransformerFactory.newInstance();
            Transformer transformer = factory.newTransformer();
            transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
            StringWriter output = new StringWriter();
            transformer.transform(new DOMSource(target), new StreamResult(output));
           
            return output.toString();
        } catch (TransformerConfigurationException e) {
            // Things must be in pretty bad shape to get here so
            // rethrow as runtime exception
View Full Code Here

TOP

Related Classes of javax.xml.transform.dom.DOMSource

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.