当前位置: 首页>>代码示例>>Java>>正文


Java XppDriver类代码示例

本文整理汇总了Java中com.thoughtworks.xstream.io.xml.XppDriver的典型用法代码示例。如果您正苦于以下问题:Java XppDriver类的具体用法?Java XppDriver怎么用?Java XppDriver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XppDriver类属于com.thoughtworks.xstream.io.xml包,在下文中一共展示了XppDriver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DriverEndToEndTestSuite

import com.thoughtworks.xstream.io.xml.XppDriver; //导入依赖的package包/类
public DriverEndToEndTestSuite() {
    super(DriverEndToEndTestSuite.class.getName());
    addDriverTest(new BEAStaxDriver());
    addDriverTest(new BinaryStreamDriver());
    addDriverTest(new Dom4JDriver());
    addDriverTest(new DomDriver());
    addDriverTest(new JDomDriver());
    addDriverTest(new JDom2Driver());
    addDriverTest(new KXml2DomDriver());
    addDriverTest(new KXml2Driver());
    addDriverTest(new StaxDriver());
    addDriverTest(new StandardStaxDriver());
    addDriverTest(new WstxDriver());
    addDriverTest(new XomDriver());
    addDriverTest(new Xpp3DomDriver());
    addDriverTest(new Xpp3Driver());
    addDriverTest(new XppDomDriver());
    addDriverTest(new XppDriver());
    addDriverTest(new JettisonMappedXmlDriver());
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:21,代码来源:DriverEndToEndTestSuite.java

示例2: XStreamXml

import com.thoughtworks.xstream.io.xml.XppDriver; //导入依赖的package包/类
public XStreamXml() {
    XStream prototype = new XStream();
    MapperWrapper mapperWrapper = new MapperWrapper(prototype.getMapper()) {
        /**
         * Overridden to force a class attribute to be emitted on elements whose tag name is not already the name or
         * alias of a class.
         */
        @Override
        public Class defaultImplementationOf(Class type) {
            return null;
        }
    };
    xStream = new XStream(prototype.getReflectionProvider(), new XppDriver(), prototype.getClassLoaderReference(),
            mapperWrapper);
    xStream.setMode(XStream.ID_REFERENCES);
}
 
开发者ID:commercehub-oss,项目名称:clouseau,代码行数:17,代码来源:XStreamXml.java

示例3: getXstream

import com.thoughtworks.xstream.io.xml.XppDriver; //导入依赖的package包/类
protected static XStream getXstream()
{
    if (xstream == null)
    {
        xstream = new XStream(new XppDriver()
        {
            @Override
            public HierarchicalStreamWriter createWriter(Writer out)
            {
                return new PrettyPrintWriter(out)
                {
                    @Override
                    protected void writeText(QuickWriter writer, String text)
                    {
                        writer.write("<![CDATA[");
                        writer.write(text);
                        writer.write("]]>");
                    }
                };
            }
        });
    }

    return xstream;
}
 
开发者ID:edwardluzi,项目名称:spring-social-wechat,代码行数:26,代码来源:Message.java

示例4: loadChart

import com.thoughtworks.xstream.io.xml.XppDriver; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public static List loadChart(File dir, String fileName) {
	try {
		File file = new File(dir, fileName + CHART_EXT);

		log.error("filepathComplete: " + file);

		XStream xStream = new XStream(new XppDriver());
		xStream.setMode(XStream.NO_REFERENCES);

		try (InputStream is = new FileInputStream(file);
				BufferedReader reader = new BufferedReader(new InputStreamReader(is, UTF_8)))
		{
			return (List) xStream.fromXML(reader);
		}
	} catch (Exception err) {
		log.error("Unexpected error while loading chart", err);
	}
	return new ArrayList<>();
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:21,代码来源:LibraryChartLoader.java

示例5: EncodingTestSuite

import com.thoughtworks.xstream.io.xml.XppDriver; //导入依赖的package包/类
public EncodingTestSuite() {
    super(EncodingTestSuite.class.getName());
    addDriverTest(new Dom4JDriver());
    addDriverTest(new DomDriver());
    addDriverTest(new JDomDriver());
    addDriverTest(new JDom2Driver());
    addDriverTest(new StaxDriver());
    if (!SystemUtils.IS_OS_WINDOWS) { // see comment below for Windows
        addDriverTest(new StandardStaxDriver());
        addDriverTest(new BEAStaxDriver());
        addDriverTest(new WstxDriver());
    }
    addDriverTest(new KXml2DomDriver());
    addDriverTest(new KXml2Driver());
    addDriverTest(new XppDomDriver());
    addDriverTest(new XppDriver());
    addDriverTest(new XomDriver());
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:19,代码来源:EncodingTestSuite.java

示例6: testCanBeOverloadedToDeserializeTransientFields

import com.thoughtworks.xstream.io.xml.XppDriver; //导入依赖的package包/类
public void testCanBeOverloadedToDeserializeTransientFields() {
    XStream xstream = new XStream(new XppDriver());
    xstream.allowTypes(TypesOfFields.class);
    xstream.alias("types", TypesOfFields.class);
    xstream.registerConverter(new ReflectionConverter(xstream.getMapper(), xstream
        .getReflectionProvider()) {

        public boolean canConvert(Class type) {
            return type == TypesOfFields.class;
        }

        protected boolean shouldUnmarshalTransientFields() {
            return true;
        }
    });

    String xml = ""
        + "<types>\n"
        + "  <normal>normal</normal>\n"
        + "  <trans>foo</trans>\n"
        + "</types>";

    TypesOfFields fields = (TypesOfFields)xstream.fromXML(xml);
    assertEquals("foo", fields.trans);
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:26,代码来源:ReflectionConverterTest.java

示例7: setUp

import com.thoughtworks.xstream.io.xml.XppDriver; //导入依赖的package包/类
protected void setUp() throws Exception {
    super.setUp();

    final ClassAliasingMapper classAliasingMapper = new ClassAliasingMapper(
        new DefaultMapper(new ClassLoaderReference(getClass().getClassLoader())));
    classAliasingMapper.addClassAlias("x", X.class);
    classAliasingMapper.addClassAlias("software", Software.class);
    classAliasingMapper.addClassAlias("open-source", OpenSourceSoftware.class);
    mapper = new DefaultImplementationsMapper(new ArrayMapper(classAliasingMapper));

    reflectionProvider = new SunUnsafeReflectionProvider();
    driver = new XppDriver();

    converterLookup = new DefaultConverterLookup();
    converterLookup.registerConverter(
        new SingleValueConverterWrapper(new StringConverter()), 0);
    converterLookup.registerConverter(
        new SingleValueConverterWrapper(new IntConverter()), 0);
    converterLookup.registerConverter(new ArrayConverter(mapper), 0);
    converterLookup.registerConverter(
        new ReflectionConverter(mapper, reflectionProvider), -1);
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:23,代码来源:ToAttributedValueConverterTest.java

示例8: createDriver

import com.thoughtworks.xstream.io.xml.XppDriver; //导入依赖的package包/类
protected HierarchicalStreamDriver createDriver() {
    // if the system property is set, use it to load the driver
    String driver = null;
    try {
        driver = System.getProperty("xstream.driver");
        if (driver != null) {
            System.out.println("Using driver: " + driver);
            Class type = Class.forName(driver);
            return (HierarchicalStreamDriver) type.newInstance();
        }
    }
    catch (Exception e) {
        throw new RuntimeException("Could not load driver: " + driver);
    }
    return new XppDriver();
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:17,代码来源:AbstractBuilderAcceptanceTest.java

示例9: setUp

import com.thoughtworks.xstream.io.xml.XppDriver; //导入依赖的package包/类
protected void setUp() throws Exception {
    super.setUp();

    // server side setup.
    ScheduledExecutorService executorService = Executors.newScheduledThreadPool(10);
    server = new SocketServer((ServerMonitor) mockServerMonitor.proxy(), new RefusingStubRetriever(), new NullAuthenticator(),
            new XmlStream(new XStream(new XppDriver())), executorService, new ThreadLocalServerContextFactory(), new InetSocketAddress(10099));
    testServer = new TestFacadeImpl();
    Publication pd = new Publication(TestFacade.class).addAdditionalFacades(TestFacade3.class, TestFacade2.class);
    server.publish(testServer, "Hello", pd);
    server.start();

    // Client side setup
    sr = new ServiceResolver(new SocketTransport(new ConsoleClientMonitor(),
            new org.codehaus.jremoting.client.streams.XmlStream(new XStream(new XppDriver())), new SocketDetails("127.0.0.1", 10099)));
    testClient = sr.resolveService("Hello");

}
 
开发者ID:paul-hammant,项目名称:JRemoting,代码行数:19,代码来源:XStreamAndXppTestCase.java

示例10: setUp

import com.thoughtworks.xstream.io.xml.XppDriver; //导入依赖的package包/类
protected void setUp() throws Exception {
    super.setUp();

    // server side setup.
    ScheduledExecutorService executorService = Executors.newScheduledThreadPool(10);
    server = new SocketServer((ServerMonitor) mockServerMonitor.proxy(), new RefusingStubRetriever(), new NullAuthenticator(),
            new XmlStream(new XStream(new XppDriver())), executorService, new ThreadLocalServerContextFactory(), new InetSocketAddress(10099));
    testServer = new TestFacadeImpl();
    Publication pd = new Publication(TestFacade.class).addAdditionalFacades(TestFacade3.class, TestFacade2.class);
    server.publish(testServer, "Hello", pd);
    server.start();

    // Client side setup
    sr = new ServiceResolver(new SocketTransport(
            new ConsoleClientMonitor(), new org.codehaus.jremoting.client.streams.XmlStream(
            new XStream(new XppDriver())), new SocketDetails("127.0.0.1", 10099)
    ), new StubsOnClient());
    testClient = sr.resolveService("Hello");

}
 
开发者ID:paul-hammant,项目名称:JRemoting,代码行数:21,代码来源:XStreamAndXppAndStubsOnClientTestCase.java

示例11: get

import com.thoughtworks.xstream.io.xml.XppDriver; //导入依赖的package包/类
public synchronized static XStream get(String type) {
	if (JAXP_DOM_XML.equals(type)) {
		xstream = createXMLXStream();
		xstream.autodetectAnnotations(true);
	} else if (XPP3_XML_PARSER.equals(type)) {
		xstream = new XStream(new XppDriver());
		xstream.autodetectAnnotations(true);
	} else if (STAX_JSON_PARSER.equals(type)) {
		xstream = new XStream(new JettisonMappedXmlDriver());
		xstream.setMode(XStream.NO_REFERENCES);
	} else if (WRITER_JSON_PARSER.equals(type)) {
		xstream = new XStream(new JsonHierarchicalStreamDriver());
		xstream.setMode(XStream.NO_REFERENCES);
	} else {
		xstream = createXMLXStream();
		xstream.autodetectAnnotations(true);
	}
	return xstream;
}
 
开发者ID:839536,项目名称:kettle,代码行数:20,代码来源:XStreamFacade.java

示例12: buildXstream

import com.thoughtworks.xstream.io.xml.XppDriver; //导入依赖的package包/类
private XStream buildXstream() {
	return new XStream(new XppDriver() {
		public HierarchicalStreamWriter createWriter(Writer out) {
			return new PrettyPrintWriter(out) {
				List<String> cdataFields = asList("title", "author");
				boolean cdata = false;
				
				public void startNode(String name, Class clazz) {
					super.startNode(name, clazz);
					cdata = cdataFields.contains(name);
				}
				protected void writeText(QuickWriter writer, String text) {
					if (cdata) {
						writer.write("<![CDATA[");
						writer.write(text);
						writer.write("]]>");
					} else {
						writer.write(text);
					}
				}
			};
		}
	});
}
 
开发者ID:caelum,项目名称:mamute,代码行数:25,代码来源:QuestionRssEntryFactory.java

示例13: saveToFile

import com.thoughtworks.xstream.io.xml.XppDriver; //导入依赖的package包/类
/**
 * writes glossary to xml-file prepend doc-book dtd: <!DOCTYPE glossary PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
 * "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
 * 
 * @param glossaryFile
 * @param glossaryItemArr
 */
private void saveToFile(VFSLeaf glossaryFile, ArrayList<GlossaryItem> glossaryItemArr) {
    // cdata-tags should be used instead of strings, overwrite writer.
    XStream xstream = new XStream(new XppDriver() {
        @Override
        public HierarchicalStreamWriter createWriter(Writer out) {
            return new PrettyPrintWriter(out) {
                @Override
                protected void writeText(QuickWriter writer, String text) {
                    if (text.contains("<") || text.contains(">") || text.contains("&")) {
                        writer.write("<![CDATA[");
                        writer.write(text);
                        writer.write("]]>");
                    } else {
                        writer.write(text);
                    }
                }
            };
        }
    });

    xstream.alias(XML_GLOSSARY_ITEM_NAME, GlossaryItem.class);
    glossaryItemArr = removeEmptyGlossaryItems(glossaryItemArr);
    XStreamHelper.writeObject(xstream, glossaryFile, glossaryItemArr);
}
 
开发者ID:huihoo,项目名称:olat,代码行数:32,代码来源:GlossaryItemManager.java

示例14: getLoteXStream

import com.thoughtworks.xstream.io.xml.XppDriver; //导入依赖的package包/类
public static XStream getLoteXStream()
{
  XStream xstream = new XStream(new XppDriver()
  {
    public HierarchicalStreamWriter createWriter(Writer out)
    {
      return new PrettyPrintWriter(out)
      {
        protected void writeText(QuickWriter writer, String text)
        {
          writer.write(text);
        }
      };
    }
  });
  xstream.alias("lote", LoteXml.class);
  xstream.alias("comprobante", ComprobanteXml.class);

  xstream.registerConverter(new ComprobanteXmlConverter());

  return xstream;
}
 
开发者ID:jorjoluiso,项目名称:FirmaDigital,代码行数:23,代码来源:XStreamUtil.java

示例15: getRespuestaXStream

import com.thoughtworks.xstream.io.xml.XppDriver; //导入依赖的package包/类
public static XStream getRespuestaXStream()
{
  XStream xstream = new XStream(new XppDriver()
  {
    public HierarchicalStreamWriter createWriter(Writer out)
    {
      return new PrettyPrintWriter(out)
      {
        protected void writeText(QuickWriter writer, String text)
        {
          writer.write(text);
        }
      };
    }
  });
  xstream.alias("respuesta", RespuestaComprobante.class);
  xstream.alias("autorizacion", Autorizacion.class);
  xstream.alias("fechaAutorizacion", XMLGregorianCalendarImpl.class);
  xstream.alias("mensaje", Mensaje.class);
  xstream.registerConverter(new RespuestaDateConverter());

  return xstream;
}
 
开发者ID:jorjoluiso,项目名称:FirmaDigital,代码行数:24,代码来源:XStreamUtil.java


注:本文中的com.thoughtworks.xstream.io.xml.XppDriver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。