XStream is a simple library to serialize objects to XML and back again.Features
Ease of use. A High level facade are supplied that simplifies common use cases.
No mappings required. Most objects can is serialized without need for specifying mappings.
performance. Speed and low memory footprint is a crucial part of the design, making it suitable for large object graphs or system s with high message throughput.
Clean XML. No information is dup
1.XStream Tool Description:This tool, the jar package for this tool, can help us to generate XML-formatted data such as JavaBean, set (LIST,SET,MAP), etc.Jar Package:Xstream-1.4.4.jar, this is the core package.Xpp3_min-1.1.4c.jar This is a must-depend packageAs long as importing these two jar packages into the build path, you can use the.2.json-lib Introduction:This jar can help us to generate JSON-formatted data such as JavaBean, set (LIST,SET,MAP),
In the previous section, we've seen how easy it is to use XStream, and this article will continue to explain XStream aliases in an instance-by-case manner. After all, your Java object may not always be as good as the XML structure, and no one is sure that a developer's hand has mistakenly hit the wrong letter, or that the name of the message has changed.Suppose we output the following XML structure, what sh
First go to the official website to download the response jar packageHttp://xstream.codehaus.org/index.htmlA minimum of two jar packages, one xstream.jar and one Xmlpull.jarFirst look at the translation of the Java object to XMLPackage Xml;class PhoneNumber {private int code;private int number;public int GetCode () {return code;} public void Setcode (int code) {this.code = code;} public int GetNumber () {return number;} public void Setnumber (int number) {this.number = number;}} public class Per
This article address: http://blog.csdn.net/kongxx/article/details/6946517
Nonsense, is not want to define too many Java beans, sometimes the need is simpler, think directly with Java Collection class to replace too many Java bean definitions, see the following code example
Package org.garbagecan.xstreamstudy.converter;
Import java.util.ArrayList;
Import Java.util.HashMap;
Import java.util.List;
Import Java.util.Map;
Import Com.thoughtworks.xstream.XStream;
Import Com.thoughtworks.xstream.io.xm
"Journey to the World" in the Tang's monk team after hardships, finally seek the Scriptures, the goal is clear, Division of labor reasonable for this team finally laid the foundation for success. Tang's monk from the beginning, for the team set the west to learn the goal, although experienced various setbacks and hardships, but the goal has never wavered. Wu empt
In project development, it is sometimes necessary to transfer XM files, to convert them into string transfers, and not to use object transfer, so the conversion is done using XStream for the mutual transfer of string and XML objects, and for converting all classes under a package.XML file parsing and creation, please refer to: http://blog.csdn.net/oyyz111/article/details/22730983First, use spring's pathmatchingresourcepatternresolver to read a class f
The back end also has a Java user object class that serializes the user object in the list into XML data using the XStream component. obtained using the E4X format format on the flex side via Httpservice.
Just started to parse XML by E4X technology, and construct flex user object, similar to the way it was handled:
Copy Code code as follows:
Public Function FromXml (currentnode:xml): void{
UserID = new number (Currentnode.userid);
using XStream to convert between Java objects and XMLXStream is a good thing, easy to convert between Java objects and XML, efficiency and readability are very high, the following is a test example I wrote, let's take a look. The required jar packages are as follows: Xpp3_min-1.1.4c.jar
Xstream-1.3.jar Goal: Convert the persons object to XML, and then convert the XML into a persons object.
implementation So
In Brooks ' man Moon myth, the concept of a Jelly team is mentioned in the L. L. Constantine's "human episode" refers to the form of creative team formation and team management, and then we look at the "Liang Jian" in the team organization, you will find that Constantine creative t
The recent message is frequent, Sogou to collect Tencent search, Baidu to collect Sogou, 360 Zhou Hongwei mihui Sogou Wang Xiaoquan, in fact, not only the big team has played a regiment, and so search for such a pioneering team quietly financing, and instant, Pan Gu search national team movements frequently, 2013 just spring, chaos.
"Yin Yue/Titan
XStream usage Java class and XML interchange
now in the era of Web data exchange, the transfer of XML is currently a popular way, with uniform rules constraints, for the implementation of the background interface provides a very convenient implementation.
I wrote a small example of receiving XML and converting it into the object class I needed, in the hope of being able to help friends who do Internet data transfer and interface calls.
First, you im
In writing this technical blog, I see the http://www.cnblogs.com/hoojo/archive/2011/04/22/2025197.html
Can also look at this, write very thin, I wrote an XML to the bean. And a bean-to-XML conversion example,
One, as a growth of a footprint, and second, summed up some code, later, in the bank and insurance, in the interface of the transmission of data, is often transmitted by the XML message.
Some encryption, your plaintext, are also required such a conversion function. So to write this blog, th
() methods@Datapublic class Bean { Private list Private list Private listPrivate d D;}Here we have the class data (), then we can't use @data annotations, can write the Get (), set () method manuallypublic class Data { Private Bean bean ; Public Bean Getbean () { return BEAN; } public void Setbean (bean bean) { This. Bean = bean; }}Class D omitted.Write a converted class againPublic class Parsexmlutil { /*** Serialization of XML strings as objects *
In some cases, the XML file is like this
Parsing with XML parsing tools is good for this XML, but cannot be tied directly to XML binding tools. Minor modifications are required.
If you are using XStream, you will add a converter to implement the converter interface. First post the interface:
Import Com.thoughtworks.xstream.converters.Converter;
Import Com.thoughtworks.xstream.converters.MarshallingContext;
Import Com.thoughtworks.xstream.converte
These two things are essentially different, JAXB called the OX binding tool, XStream should be counted as a serialization tool, but the OX binding tool also Marshall and Unmarshall, so it contains the serialization part. The serialization tool does not necessarily need to provide binding functionality. Now that you're playing with serialization, simply compare the two of them in terms of serialization.
Jaxb:toplink JAXB 10133, which should be the JAX
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.