Package javax.xml.transform.dom

Examples of javax.xml.transform.dom.DOMResult


        writeItemToSAX(saxhdlr);
    }

    public void writeItemToResult(Result result) throws XQException {
        if(result instanceof DOMResult) {
            final DOMResult domResult = (DOMResult) result;
            final Node rootNode = domResult.getNode();
            final Node newNode = getNode();
            if(rootNode != null) {
                rootNode.appendChild(newNode); // REVIEWME
            } else {
                domResult.setNode(newNode);
            }
        } else if(result instanceof SAXResult) {
            ContentHandler handler = ((SAXResult) result).getHandler();
            writeItemToSAX(handler);
        } else if(result instanceof StreamResult) {
View Full Code Here


        } else {
            throw new IllegalArgumentException("HTMLwithXSLBuilder2::transform : Illegal argument for XSL input");
        }

        if (aHtmlOutput instanceof Node) {
            tOutputTarget = new DOMResult((Node)aHtmlOutput);
        } else if (aHtmlOutput instanceof OutputStream) {
            tOutputTarget = new StreamResult((OutputStream)aHtmlOutput);
        } else if (aHtmlOutput instanceof Writer) {
            tOutputTarget = new StreamResult((Writer)aHtmlOutput);
        } else {
View Full Code Here

   */
  protected Document transformXML(Document xmlOld, String xslFile,
      Message message) throws XException
  {
    Document xmlNew = null;
    DOMResult domResult = new DOMResult();

    try
    {
      Transformer transformer = getXSLTransformer(xslFile);
      transformer.transform(new DOMSource(xmlOld), domResult);
      xmlNew = (Document) domResult.getNode();
      applyStylets(xmlNew, message);
    }
    catch (TransformerConfigurationException e)
    {
      throw new XException(Constants.LOCATION_INTERN,
View Full Code Here

                Marshaller u = context.createMarshaller();
                u.setProperty(Marshaller.JAXB_ENCODING , "UTF-8");
                u.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
                u.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE)
               
                DOMResult domResult = new DOMResult();
                u.marshal(obj, domResult);
                dest.addDocument((Document)domResult.getNode());               
               
            }
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
View Full Code Here

                        node = ((DOMSource)node).getNode();
                        doTransform = false;
                    }
                   
                    if (doTransform) {
                        DOMResult domResult = new DOMResult();
                        domResult.setSystemId(source.getSystemId());
                       
                        XML_TRANSFORMER.transform(source, domResult);
   
                        node = domResult.getNode();
                    }
                   
                    if (null != node) {
                        if (node instanceof Document) {
                            ((Document)node).setDocumentURI(source.getSystemId());
View Full Code Here

    public SAXSource invoke(SAXSource request) {
        SAXSource response = new SAXSource();
        try {
           
            DOMResult domResult = new DOMResult();
            Transformer transformer = TransformerFactory.newInstance().newTransformer();
            transformer.transform(request, domResult);
            Node n = domResult.getNode().getFirstChild();

            while (n.getNodeType() != Node.ELEMENT_NODE) {
                n = n.getNextSibling();
            }
            if (n.getLocalName().equals(sayHi.getLocalPart())) {
View Full Code Here

    }

    public StreamSource invoke(StreamSource request) {
        StreamSource response = new StreamSource();
        try {
            DOMResult domResult = new DOMResult();
            Transformer transformer = TransformerFactory.newInstance().newTransformer();
            transformer.transform(request, domResult);
            Node n = domResult.getNode().getFirstChild();

            while (n.getNodeType() != Node.ELEMENT_NODE) {
                n = n.getNextSibling();
            }
            if (n.getLocalName().equals(sayHi.getLocalPart())) {
View Full Code Here

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

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

    processor.setContentHandler(new WhitespaceFilter(handler));

    parser.setContentHandler(processor);
    parser.parse(new InputSource(getClass().getClassLoader().getResourceAsStream(in)));

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

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

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

    parser.setContentHandler(new WhitespaceFilter(handler));
    parser.parse(new InputSource(getClass().getClassLoader().getResourceAsStream(in)));

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

    Transformer streamer = streamerfactory.newTransformer();

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

    processor.setContentHandler(new WhitespaceFilter(serializer, new ConsoleLog(ConsoleLog.INFO)));

    streamer.transform(new DOMSource(node), new SAXResult(processor));

    return (Document)result.getNode();
  }
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.