Package com.thoughtworks.xstream.io.xml

Examples of com.thoughtworks.xstream.io.xml.DomWriter


    public Node transform(XObject source, TransformationContext context) {
        try {
            MetaObject mj = new MetaObjectImpl(source);
            Document root = DOMHelper.newDocument();
            DomWriter out = new DomWriter(DOMHelper.newDocument());
            XStream xs = new XStream();
            xs.alias("xobject", mj.getClass());
            xs.marshal(source, out);
            DOMHelper.adjustElementName(context, root.getDocumentElement());
            return root;
View Full Code Here


    public void marshal(MessageExchange exchange, NormalizedMessage message, Object body) throws MessagingException {
        if (useDOM) {
            try {
                Document document = transformer.createDocument();
                getXStream().marshal(body, new DomWriter(document));
                message.setContent(new DOMSource(document));
            } catch (ParserConfigurationException e) {
                throw new MessagingException("Failed to marshal: " + body + " to DOM document: " + e, e);
            }
        } else {
View Full Code Here

    public void marshal(MessageExchange exchange, NormalizedMessage message, Object body) throws MessagingException {
        if (useDOM) {
            try {
                Document document = transformer.createDocument();
                getXStream().marshal(body, new DomWriter(document));
                message.setContent(new DOMSource(document));
            }
            catch (ParserConfigurationException e) {
                throw new MessagingException("Failed to marshal: " + body + " to DOM document: " + e, e);
            }
View Full Code Here

  @Override
  protected void marshalDomNode(Object graph, Node node) throws XmlMappingException {
    HierarchicalStreamWriter streamWriter;
    if (node instanceof Document) {
      streamWriter = new DomWriter((Document) node, this.nameCoder);
    }
    else if (node instanceof Element) {
      streamWriter = new DomWriter((Element) node, node.getOwnerDocument(), this.nameCoder);
    }
    else {
      throw new IllegalArgumentException("DOMResult contains neither Document nor Element");
    }
    doMarshal(graph, streamWriter, null);
View Full Code Here

            documentBuilder = documentBuilderFactory.newDocumentBuilder();
        } catch (ParserConfigurationException e) {
            throw (IOException)new IOException("Cannot instantiate " + Document.class.getName()).initCause(e);
        }
        Document document = documentBuilder.newDocument();
        DomWriter writer = new DomWriter(document);

        XStream xstream = XStreamUtil.createXStream();
        xstream.marshal(gbeanDatas, writer);

//        FileWriter w = new FileWriter("target/foo.xml");
View Full Code Here

TOP

Related Classes of com.thoughtworks.xstream.io.xml.DomWriter

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.