XStream Notes


  • If the java class the XStream using is an inner class, you will find something like Outer-class in the xml,  better don't use inner class for XStream.
  • If you have a filed called "children" which is a list of object, but you don't want to show the name of "children", you want only show the list of object directly, you could doxs.addImplicitCollection(Node.class, "children"); in this way, "children" will not show up in xml file.
  • If you want one attribute name showed in side the tag, using xs.useAttributeFor(Employee.class, "name");
  • <employee>
  •     <name>Jack</name>
  •     <role>Manager</role>
  •     <department>Finance</department>
  •   </employee>
  • to 
  • <employee name="Jack">
  •     <role>Manager</role>
  •     <department>Finance</department>
  •   </employee>