Package javax.xml.transform.dom

Examples of javax.xml.transform.dom.DOMResult


      return null;

    TransformerFactory streamerfactory = TransformerFactory.newInstance();
    Transformer streamer = streamerfactory.newTransformer();

    DOMResult result = new DOMResult();

    streamer.transform(new DOMSource(node), result);

    return (Document)result.getNode();
  }
View Full Code Here


    XMLReader parser = parserfactory.newSAXParser().getXMLReader();

    SAXTransformerFactory serializerfactory =
      (SAXTransformerFactory)SAXTransformerFactory.newInstance();
    TransformerHandler handler = serializerfactory.newTransformerHandler();
    DOMResult result = new DOMResult();
    handler.setResult(result);

    parser.setContentHandler(new WhitespaceFilter(handler));

    InputSource inputsource = new InputSource(in);
    inputsource.setSystemId(filename);
    parser.parse(inputsource);

    return (Document)result.getNode();
  }
View Full Code Here

    }

    public Node evaluateAsDOM(Exchange exchange) throws Exception {
        initialize(exchange);

        DOMResult result = new DOMResult();
        DynamicQueryContext context = createDynamicContext(exchange);
        XQueryExpression expression = getExpression();
        expression.pull(context, result, properties);
        return result.getNode();
    }
View Full Code Here

        }

        Transformer  transformer  = JDBCSQLXML.getIdentityTransformer();
        InputStream  stream       = this.getBinaryStreamImpl();
        StreamSource streamSource = new StreamSource();
        DOMResult    result       = new DOMResult();

        streamSource.setInputStream(stream);

        try {
            transformer.transform(streamSource, result);
        } catch (TransformerException ex) {
            throw Exceptions.transformFailed(ex);
        }
        source.setNode(result.getNode());
        source.setSystemId(result.getSystemId());

        return (T) source;
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    protected <T extends Result>T createDOMResult(
            Class<T> resultClass) throws SQLException {

        try {
            T result = (resultClass == null) ? ((T) new DOMResult())
                    : resultClass.newInstance();

            this.domResult = (DOMResult) result;

            return result;
View Full Code Here

        try {
            handler = new SAX2DOMBuilder();
        } catch (ParserConfigurationException ex) {
            throw Exceptions.resultInstantiation(ex);
        }
        this.domResult = new DOMResult();

        result.setHandler(handler);
        this.domResult.setNode(handler.getDocument());

        return (T) result;
View Full Code Here

        StAXResult result = null;

        try {
            this.domResult =
                new DOMResult((new SAX2DOMBuilder()).getDocument());

            XMLOutputFactory factory = XMLOutputFactory.newInstance();
            XMLStreamWriter xmlStreamWriter =
                factory.createXMLStreamWriter(this.domResult);
View Full Code Here

    try{
      if (!xmlFile.exists()){
        if (!xmlFile.createNewFile()) throw new Exception("Failed to create "+xmlFile.getAbsolutePath());
      }
      FileOutputStream fos = new FileOutputStream(xmlFile);
      DOMResult domResult = new DOMResult();
      StreamResult result = new StreamResult(fos);
      DOMSource source = new DOMSource(xpath.document);
      getLog().debug9("managed2liveTransformer: "+managed2liveTransformer);
     
      managed2liveTransformer.transform(source, result);
View Full Code Here

    // Less painful to do this using XMLUnit if you use it.
    XMLEventReader reader = _inputFactory.createXMLEventReader(new StringReader(string));
    final DocumentBuilderFactory documentBuilder = DocumentBuilderFactory.newInstance();
    documentBuilder.setNamespaceAware(true);
    final Document document = documentBuilder.newDocumentBuilder().newDocument();
    XMLEventWriter writer = _outputFactory.createXMLEventWriter(new DOMResult(document));
    writer.add(reader);
    return document;
  }
View Full Code Here

{
    // [WSTX-257]
    public void testFragmentIssue257() throws Exception
    {
        DocumentFragment fragment = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument().createDocumentFragment();
        XMLStreamWriter xmlWriter = getOutputFactory().createXMLStreamWriter(new DOMResult(fragment));
        // create equivalent of "<a>value1</a><b>value2</b>"
        xmlWriter.writeStartElement("a");
        xmlWriter.writeCharacters("value1");
        xmlWriter.writeEndElement();
        xmlWriter.writeStartElement("b");
View Full Code Here

TOP

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

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.