What is Java alternative for .NET's XmlSeriali

2020-04-13 05:13发布

问题:

I'm porting c# application to Java and don't know what it is doing in details. With what should I replace .Net's XmlSerializer in Java?

Thank you.

回答1:

XStream is a simple library to serialize objects to XML and back again.

  • Download XStream
  • XStream - Two Minute Tutorial


回答2:

JAXB is your best bet and its also a Java standard.

Interesting posts: (Courtesy of Blaise Doughan)

  • How does JAXB compare to XStream
  • How does JAXB compare to Simple


回答3:

In java you can use different technology to serialize/deserialize XML.

From an XML schema :

  • There is the standard JaxB : http://jaxb.java.net/
  • But I prefer XmlBeans : http://xmlbeans.apache.org/ which is more straightforward IMHO.

With XPath :

  • Use the class javax.xml.xpath.XPathFactory


回答4:

Castor is another simple to use XML data-binding framework for Java.