當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。