Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4.5
    • Component/s: None
    • Labels:
      None
    • JDK version and platform:
      1.4

      Description

      Map Converter should not use the position of an element to determine if its a key or a value
      The current implementation assumes that the key comes first and then the value:
      <entry>
      <obj1/>
      <obj2/>
      </entry>

      where obj1 is assumed to be the key and obj2 the value.

      Another thing about MapConverter is that it doesn't take into account the new "asAttribute" feature, and if one is working with ... let's say Strings and Integers and we have set
      xstream.useAttributeFor(String.class);
      xstream.useAttributeFor(Integer.class);
      xstream.useAttributeFor(Double.class);

      Nothing happends.

      The attach is a solution for this
      If the useAttributeFor is set then
      the xml will be formatted:
      <entry key="key" keyType="string" value="3" valueType="int"/>
      <entry key="key2" keyType="string" value="4.0" valueType="double"/>

      else:
      <entry>
      <key>
      <string>key</string>
      </key>
      <value>
      <int>3</int>
      </value>
      </entry>
      <entry value="4.0" valueType="double">
      <key>
      <string>key2</string>
      </key>
      </entry>

      Note that now the order of key/value is not important because they are encapsulated into the <key>/<value> tags

        Issue Links

          People

          • Assignee:
            Jörg Schaible
            Reporter:
            Fernando Otero
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: