Is there any open source Object to XML serializer in Java that uses writeObject method
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.
精彩评论