开发者

Is there any open source Object to XML serializer in Java that uses writeObject method

开发者 https://www.devze.com 2022-12-23 01:46 出处:网络
Is there any open source Object to XML serializer in Java that uses writeObject method on the object to serialize similar to NSXMLOutputStream in WebObj开发者_如何学Cects?Take a look at http://x-strea

Is there any open source Object to XML serializer in Java that uses writeObject method on the object to serialize similar to NSXMLOutputStream in WebObj开发者_如何学Cects?


Take a look at http://x-stream.github.io/ though I don't know if it use those methods on the class Object.

What do you want to use those methods?


Take a look at XMLEncoder/XMLDecoder classes, which behave like obejct serialization in XML.

These classes are part of the JDK since its 1.4 version.


Not sure exactly what you are asking, but I would suggest you look at JAXB, one great Java standard for XML serialization.

Most of the serialization can be defined using annotations, but you can provide your own serialization as well using so-called adapters.

You can then marshall/unmarshall from/to XML as you want. See this answer for an example.

0

精彩评论

暂无评论...
验证码 换一张
取 消