Package com.thoughtworks.xstream.io.xml

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


    public boolean canConvert(Class clazz) {
        return Document.class.isAssignableFrom(clazz) || Element.class.isAssignableFrom(clazz);
    }

    public void marshal(Object object, HierarchicalStreamWriter writer, MarshallingContext marshallingContext) {
        DomReader reader;
        if (object instanceof Document) {
            Document doc = (Document) object;
            reader = new DomReader(doc);
        } else {
            Element element = (Element) object;
            reader = new DomReader(element);
        }

        copy(reader, writer);
    }
View Full Code Here


            // Set the thread context classloader so deserializing classes can grab the cl from the thread
            ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
            try {
                Thread.currentThread().setContextClassLoader(classLoader);

                DomReader reader = new DomReader(element);
                XStream xstream = XStreamUtil.createXStream();
                xstream.setClassLoader(classLoader);
                Object o = xstream.unmarshal(reader);
                GBeanData[] gbeanDatas = (GBeanData[]) o;
                return Arrays.asList(gbeanDatas);
View Full Code Here

     * @return A POJO representation of the given XML fragment.
     *
     */
    public Object fromXML(Element xml)
    {
        return getXStream().unmarshal(new DomReader(xml));
    }
View Full Code Here

    @Override
    public Object evaluate(MessageExchange exchange, NormalizedMessage message) throws MessagingException {
        Object node = super.evaluate(exchange, message, XPathConstants.NODE);
        HierarchicalStreamReader streamReader;
        if (node instanceof Document) {
            streamReader = new DomReader((Document) node);
        } else if (node instanceof Element) {
            streamReader = new DomReader((Element) node);
        } else {
            throw new IllegalArgumentException("DOMResult contains neither Document nor Element: " + node.getClass().getName());
        }
        return getXStream().unmarshal(streamReader);
    }
View Full Code Here

    public boolean canConvert(Class clazz) {
        return Document.class.isAssignableFrom(clazz) || Element.class.isAssignableFrom(clazz);
    }

    public void marshal(Object object, HierarchicalStreamWriter writer, MarshallingContext marshallingContext) {
        DomReader reader;
        if (object instanceof Document) {
            Document doc = (Document) object;
            reader = new DomReader(doc);
        } else {
            Element element = (Element) object;
            reader = new DomReader(element);
        }

        copy(reader, writer);
    }
View Full Code Here

            // Set the thread context classloader so deserializing classes can grab the cl from the thread
            ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
            try {
//                Thread.currentThread().setContextClassLoader(bundle);

                DomReader reader = new DomReader(element);
                XStream xstream = XStreamUtil.createXStream();
                //TODO Obviously, totally broken
//                xstream.setClassLoader(bundle);
                Object o = xstream.unmarshal(reader);
                GBeanData[] gbeanDatas = (GBeanData[]) o;
View Full Code Here

*/
public class Node2XObject extends BaseTransformer<Node, XObject> implements PullTransformer<Node, XObject> {

    public XObject transform(Node source, TransformationContext context) {
        try {
            DomReader in = null;
            if (source instanceof Document) {
                in = new DomReader((Document)source);
            } else if (source instanceof Element) {
                in = new DomReader((Element)source);
            }
            XStream xs = new XStream();
            return (XObject)xs.unmarshal(in);
        } catch (Exception e) {
            throw new TransformationException(e);
View Full Code Here

    Response response = client.handle(request);
   
    try {
      //System.out.println(response.getStatus()+response.getEntity().getText());
      UserStatus s = (UserStatus)xstream.unmarshal(
          new DomReader(response.getEntityAsDom().getDocument()));
      System.out.println(s.getScreen_name()+"-"+s.getStatus().getText());
      return s;
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

    auth(request);
    Response response = client.handle(request);
   
    try {
      //System.out.println(response.getStatus()+response.getEntity().getText());
      User s = (User)xstream.unmarshal(new DomReader(response.getEntityAsDom().getDocument()));
      System.out.println(s.getScreen_name());
      return s;
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here

    auth(request);   
    Response response = client.handle(request);
    try {
      //System.out.println(response.getStatus()+response.getEntity().getText());
      StatusList s = (StatusList) xstream.unmarshal(
          new DomReader(response.getEntityAsDom().getDocument()));
      System.out.println(s.getStatuses().size());
      for(Status it : s.getStatuses()){
        System.out.println(it);
      }
      return s.getStatuses();
View Full Code Here

TOP

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

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.