XStream
  1. XStream
  2. XSTR-614

CLONE -Make an option to create primitive and String properties as attributes.

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: 1.x Maintenance
    • Component/s: None
    • Labels:
      None

      Description

      Currently, the xml XStream is created is quite straight forward and sometimes it is producing unnecessary tags for the object properties. For example:

      class Student
      {
      String name="blah";
      String lastname = "bloh";
      }

      public class School
      {
      String name = "My school";
      int numberOfStudents = 1234;
      List students;
      }

      AFAIK, current XSteam is producing this XML for such classes (lets assume we make necessary aliases)

      <school>
      <name>My School</name>
      <numberOfStudents>1234</numberOfStudents>
      <students>
      <student>
      <name>blah</name>
      <surname>bloh</name>
      </student>
      ....
      </students>
      </school>

      But if you make primitive and String (and perhaps StringBuffer) properties of a class as attributes of an xml element, resulting xml qould be much shorter. like:

      <school name="My School" numberOfStudents="1234">
      <students>
      <student name="blah" surname="bloh" />
      ....
      </students>
      </school>

      i gues it does not disturb the background work of the XStream becuase there still is no configuration file whatsoever. only a set value like "MAKE_PRIMITIVES_ATTRIBUTES" would be enough for the user.

        Issue Links

          People

          • Assignee:
            Jörg Schaible
            Reporter:
            paul hinds
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: