Package com.thoughtworks.xstream

Examples of com.thoughtworks.xstream.XStream.fromXML()


    connectionModel.setCubeName(cubeName);
  }
 
  public void deserializeAggList(Schema schema, String xml) {
    XStream xstream = getXStream(schema);
    xstream.fromXML(xml);
  }

  public void setConnectionModel(ConnectionModel connectionModel) {
 
    this.connectionModel = connectionModel;
View Full Code Here


        XStream xstream = new XStreamFactory().getInstance();
        String mapXML = xstream.toXML(map);
        assertNotNull(mapXML);
        assertTrue(StringUtils.isNotEmpty(mapXML));

        Object newMap = xstream.fromXML(mapXML);
        assertNotNull(newMap);
        assertTrue(newMap instanceof ConcurrentHashMap);
        assertEquals(1, ((Map)newMap).size());
        assertEquals("bar", ((Map)newMap).get("foo"));
    }
View Full Code Here

        XStream xs = xmlConfig.getConfiguredXStream(new XStream(new DomDriver()));

        WMSLayer newLayer = null;

        if (formatExtension.equalsIgnoreCase("xml")) {
            newLayer = (WMSLayer) xs.fromXML(is);
        } else if (formatExtension.equalsIgnoreCase("json")) {
            HierarchicalStreamDriver driver = new JettisonMappedXmlDriver();
            HierarchicalStreamReader hsr = driver.createReader(is);
            // See http://jira.codehaus.org/browse/JETTISON-48
            StringWriter writer = new StringWriter();
View Full Code Here

            // See http://jira.codehaus.org/browse/JETTISON-48
            StringWriter writer = new StringWriter();
            new HierarchicalStreamCopier().copy(
                    hsr, new PrettyPrintWriter(writer));
            writer.close();
            newLayer = (WMSLayer) xs.fromXML(writer.toString());
        } else {
            throw new RestletException("Unknown or missing format extension: "
                    + formatExtension, Status.CLIENT_ERROR_BAD_REQUEST);
        }
View Full Code Here

        SeedRequest sr = null;
       
        XStream xs = xmlConfig.getConfiguredXStream(new XStream(new DomDriver()));
       
        if(formatExtension.equalsIgnoreCase("xml")) {
            sr = (SeedRequest) xs.fromXML(req.getEntity().getStream());
        } else if(formatExtension.equalsIgnoreCase("json")){
            sr = (SeedRequest) xs.fromXML(convertJson(req.getEntity().getText()));
        } else {
            throw new RestletException("Format extension unknown or not specified: "
                    + formatExtension,
View Full Code Here

        XStream xs = xmlConfig.getConfiguredXStream(new XStream(new DomDriver()));
       
        if(formatExtension.equalsIgnoreCase("xml")) {
            sr = (SeedRequest) xs.fromXML(req.getEntity().getStream());
        } else if(formatExtension.equalsIgnoreCase("json")){
            sr = (SeedRequest) xs.fromXML(convertJson(req.getEntity().getText()));
        } else {
            throw new RestletException("Format extension unknown or not specified: "
                    + formatExtension,
                    Status.CLIENT_ERROR_BAD_REQUEST);
        }
View Full Code Here

        XStreamPathConverter pConv = new XStreamPathConverter();
        pConv.setPrependSlash(true);
        xStream.registerConverter(pConv);

        try {
          return xStream.fromXML(new InputStreamReader(is, "UTF-8"));
        } catch (StreamException ex) {
          return xStream.fromXML(is);
        }
      } catch (IOException ex) {
        ex.printStackTrace();
View Full Code Here

        xStream.registerConverter(pConv);

        try {
          return xStream.fromXML(new InputStreamReader(is, "UTF-8"));
        } catch (StreamException ex) {
          return xStream.fromXML(is);
        }
      } catch (IOException ex) {
        ex.printStackTrace();
      } finally {
        if (is != null) {
View Full Code Here

            DbProperties props = agent.getProperties();
            XStream xstream = new XStream();
            xstream.alias("macro", Macro.class);
            xstream.alias("macrogroup", MacroGroup.class);
            MacroGroup group = (MacroGroup)xstream.fromXML(personalMacro);

            String saveString = xstream.toXML(group);

            try {
                props.deleteProperty("personal.macro");
View Full Code Here

        if (form != null) {
            XStream xstream = new XStream();
            xstream.setClassLoader(this.getClass().getClassLoader());

            try {
                return (DataForm) xstream.fromXML(form);
            }
            catch (Exception e) {
                Log.error(e.getMessage(), e);
            }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.