<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel about="http://blog.gmane.org/gmane.comp.java.xstream.user">
    <title>gmane.comp.java.xstream.user</title>
    <link>http://blog.gmane.org/gmane.comp.java.xstream.user</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.java.xstream.user/5359"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.java.xstream.user/5353"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.java.xstream.user/5345"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.java.xstream.user/5343"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.java.xstream.user/5342"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.java.xstream.user/5330"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.java.xstream.user/5327"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.java.xstream.user/5326"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.java.xstream.user/5323"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.java.xstream.user/5321"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.java.xstream.user/5318"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.java.xstream.user/5316"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.java.xstream.user/5307"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.java.xstream.user/5305"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.java.xstream.user/5303"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.java.xstream.user/5298"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.java.xstream.user/5294"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.java.xstream.user/5285"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.java.xstream.user/5283"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.java.xstream.user/5282"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5359">
    <title>change close tags ?</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5359</link>
    <description>hi XStream people :-)
First off all, thanks to XStream, this library is really helpful to our
project. thanks again.

I 'm writing some converts and my xml is:

&lt;ArrayOfOperationEvent&gt;
    *&lt;OperationEvent p3:type="InfoToDisplayEvent"
xmlns:p3="http://www.w3.org/2001/XMLSchema-instance"&gt;*
       &lt;infoType&gt;2&lt;/infoType&gt;
       &lt;type&gt;8&lt;/type&gt;
       &lt;value&gt;Test Case Radio Button&lt;/value&gt;
    *&lt;/OperationEvent p3:type="InfoToDisplayEvent"
xmlns:p3="http://www.w3.org/2001/XMLSchema-instance"&gt;*
 &lt;/ArrayOfOperationEvent&gt;

and I need this:

&lt;ArrayOfOperationEvent&gt;
      * &lt;OperationEvent p3:type="InfoToDisplayEvent"
xmlns:p3="http://www.w3.org/2001/XMLSchema-instance"&gt;*
             &lt;infoType&gt;2&lt;/infoType&gt;
              &lt;type&gt;8&lt;/type&gt;
             &lt;value&gt;Test Case Radio Button&lt;/value&gt;
       *&lt;/OperationEvent&gt;*
 &lt;/ArrayOfOperationEvent&gt;


the differences is in the close node of OperationEvent.


some ideas ?
maybe some subString ggrrrrr ...

thanks!
jp

</description>
    <dc:creator>juan pablo</dc:creator>
    <dc:date>2008-12-04T01:37:18</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5353">
    <title>PropertiesConverter with custom name for property?</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5353</link>
    <description>Is it possible to somehow configure the PropertiesConverter so it is able to parse the following?

&lt;paths&gt;
  &lt;path name="path1" value="C:\Path1"/&gt;
&lt;/paths&gt;

What I can parse now is the following:

&lt;paths&gt;
  &lt;property name="path1" value="C:\Path1"/&gt;
&lt;/paths&gt;

Thanks,
/Henrik
</description>
    <dc:creator>Henrik Dohlmann</dc:creator>
    <dc:date>2008-12-03T15:10:04</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5345">
    <title>References between two separate XML's</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5345</link>
    <description>Hi,

from the docs and samples it seems that references are only possible in one XML,
but not cross-XML.

Is there a way to have references between two separate XML's ?


For example, i have two classes Reference and Entity :

&lt; at &gt;XStreamAlias("reference")
public class Reference
{
    public String    id;
...
}

&lt; at &gt;XStreamAlias("entity")
public class Entity
{
    public String    id;
    public Reference reference;
...
}

I need to serialize object instances to separate XML-Files. I cannot use a
single object-graph.


&lt; at &gt;Test
public void testEntityWithReference()
{
    ...

    // setup im memory
    Reference ref = new Reference("ref");
    Entity entity = new Entity("entity");
    entity.reference = ref;
    assertSame(ref, entity.reference);

    // write to directory
    Map&lt;String, Object&gt; writeMap = new XmlMap(new FileStreamStrategy(directory_,
xstream_));
    writeMap.put(ref.getId(), ref);
    writeMap.put(entity.getId(), entity);

    // read from directory
    Map&lt;String, Object&gt; readMap = new XmlMap(new FileStreamStrategy(directory_,
xstream_));

    assertEquals(writeMap.size(), readMap.size());
    ref = (Reference)readMap.get("ref");
    assertNotNull(ref);
    entity = (Entity)readMap.get("entity");
    assertNotNull(entity);

    // !!!! this fails !!!!
    assertSame(ref, entity.reference);
}

Thx



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



</description>
    <dc:creator>xjn</dc:creator>
    <dc:date>2008-12-02T17:39:42</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5343">
    <title>How to avoid conversion of quote</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5343</link>
    <description>Hi, I have problem with converting quotes, what I can't do in my target XML.
My class:
class A { String B = "\"VALUE\""; }
Target XML should look like:
&lt;A&gt;
   &lt;B&gt;"VALUE"&lt;/B&gt;
&lt;/A&gt;
but now I get
&lt;A&gt;
   &lt;B&gt;&amp;quot;VALUE&amp;quot;&lt;/B&gt;
&lt;/A&gt;

How can I avoid of conversion " to &amp;quot;?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



</description>
    <dc:creator>TouDick</dc:creator>
    <dc:date>2008-12-02T15:14:17</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5342">
    <title>modification done to XStream 1.3 and enhancement request</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5342</link>
    <description>Hi. This is Alex Shields.  This email is to inform you (as requested by my
boss) of a change I made to the code for XStream 1.3 and a request to the
developers of XStream to make some similar change to the code permanent.



Problem:
We want objects to not be referred to with the xpath notation like so:
"../../..".  Instead, we want some objects to have an id reference that may
have come from a database, for example.  Basically, we want to run our 
Converter class methods _before_ the check that an object is already one of
the parents of the current object.  So it'll bypass the part in the code 
where the xpath references are written.



Scenario (the code below is modified for brevity):
1. We have a class called Person.  It looks like this:

class Person {
&lt; at &gt;XStreamConverter(SimplePersonConverter.class)
public Person father;

&lt; at &gt;XStreamConverter(SimplePersonConverter.class)
public Person mother;

public Family family;
public String firstName;
}

2. We have a Family class:
class Family {
&lt; at &gt;XStreamConverter(SimplePersonConverter.class)
public Person mother;

&lt; at &gt;XStreamConverter(SimplePersonConverter.class)
public Person father;

&lt; at &gt;XStreamConverter(SimplePersonConverter.class)
public Person son;
}

3. SimplePersonConverter's marshal method looks like this:


public void marshal(Object source,
HierarchicalStreamWriter writer, 
MarshallingContext context)
{
Person person;
        
      person=(Person)source;
        
writer.setValue(person.firstName);
}


4. We have a main method:

public static void main(String[] args) {
    Family family;
    Person mother, father, son;
        
    // Make a family with 3 people.
    family=new Family();
    mother=new Person();
    father=new Person();
    son=new Person();
    family.son=son;
    family.father=father;
    family.mother=mother;
        
    son.family=family;
    son.father=father;
    son.mother=mother;
    son.firstName="joe";
        
    father.family=family;
    father.firstName="stan";
        
    mother.family=family;
    mother.firstName="agnes";
        
    stdout(marshalFromObject(son));
}

stdout() just writes to System.out and my marshalFromObject() method returns 
the xml as a String by calling xstream.toXML().


5. main() as it is written above will output this:

&lt;Person&gt;
  &lt;father&gt;stan&lt;/father&gt;
  &lt;mother&gt;agnes&lt;/mother&gt;
  &lt;family&gt;
    &lt;son reference="../.."/&gt;
    &lt;mother reference="../../mother"/&gt;
    &lt;father reference="../../father"/&gt;
  &lt;/family&gt;
  &lt;firstName&gt;joe&lt;/firstName&gt;
&lt;/Person&gt;

6. What I want to output instead is this:

&lt;Person&gt;
  &lt;father&gt;stan&lt;/father&gt;
  &lt;mother&gt;agnes&lt;/mother&gt;
  &lt;family&gt;
    &lt;son&gt;joe&lt;/son&gt;
    &lt;mother&gt;agnes&lt;/mother&gt;
    &lt;father&gt;stan&lt;/father&gt;
  &lt;/family&gt;
  &lt;firstName&gt;joe&lt;/firstName&gt;
&lt;/Person&gt;



Cause of the xpaths:
1. It's in com.thoughtworks.xstream.core.AbstractReferenceMarshaller in the
method:

public void convert(Object item, Converter converter)

This if statement does it:

if (existingReferenceKey != null) {
writer.addAttribute(getMapper().aliasForAttribute("reference"),
    createReference(currentPath, existingReferenceKey));
}


Solution:
(This solution is simplistic since I have only delved into the code for a few
hours.)

1. I modified this interface:

com.thoughtworks.xstream.converters.Converter

I added this method:

public boolean isCustomConverter();


2.  This idea behind the new method is that if _I_ write the Converter class,
it will always return true for isCustomConverter().  If the converter is one
that comes with XStream, then it always returns false.  This requires that I
modified all of the XStream converter classes to add the new method.  For
example, I changed RegexPatternConverter and ReflectionConverter and a bunch
of others.

3. I modified this class:

com.thoughtworks.xstream.core.AbstractReferenceMarshaller

I modified this code:

if (existingReferenceKey != null) {
writer.addAttribute(getMapper().aliasForAttribute("reference"),
 createReference(currentPath, existingReferenceKey));
}

To now be:

if (existingReferenceKey != null &amp;&amp; !converter.isCustomConverter()) {
writer.addAttribute(getMapper().aliasForAttribute("reference"),
 createReference(currentPath, existingReferenceKey));
}

4. I rebuilt the xstream-1.3.jar file.  (If it matters, I rebuilt it in
Netbeans with java1.6.)

5. I modified my SimplePersonConverter class to have the isCustomConverter
method and it always returns true.

6. After all that, I get the xml output I wanted.  If the actual source code
I used is requested, I could make that available somehow.



Requested change to XStream:

XStream could possibly make due with some modification to its annotations to
allow for some "ignore graph cycle" feature.  So if an object has occurred
already in the graph of objects, it won't output a reference but rather use
a converter.




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



</description>
    <dc:creator>Alex Shields</dc:creator>
    <dc:date>2008-12-02T14:21:32</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5330">
    <title>RV: Arraylist</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5330</link>
    <description>Hi all,

 

I need map this estruct:

 

&lt;a&gt;
&lt;string&gt;cad w/o fees&lt;/string&gt;
&lt;string&gt;susp&lt;/string&gt;
&lt;string&gt;late&lt;/string&gt;
&lt;string&gt;badck&lt;/string&gt;
&lt;string&gt;other&lt;/string&gt;
&lt;string&gt;corp&lt;/string&gt;
&lt;/a&gt;

 

try with data type arraylist but no work! can any body help me?

 

Thanks

Alejandro.

 

 

</description>
    <dc:creator>Alejandro Vergara</dc:creator>
    <dc:date>2008-12-01T17:13:28</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5327">
    <title>Conversion Exception</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5327</link>
    <description>
--------------------------------------------
</description>
    <dc:creator>Lucas Eskopinski</dc:creator>
    <dc:date>2008-12-01T16:54:27</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5326">
    <title>Issue implementing Serializable interface</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5326</link>
    <description>Hi Joerg,
I am using XStream to deserialize an object from XML and I keep getting the
following fail message:

com.thoughtworks.xstream.converters.ConversionException: Cannot deserialize
object with new readObject()/writeObject() methods

---- Debugging information ----
class               : com.Request
required-type    : com.Request
path                : /work_request
line number         : 1
-------------------------------

at
com.thoughtworks.xstream.converters.reflection.SerializableConverter.doUnmarshal(SerializableConverter.java:270)
at
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:150)
at
com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:81)
at
com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:55)
at
com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:75)
at
com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:59)
at
com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:142)
at
com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:33)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:931)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:917)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:861)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:853)


After much digging through XStream source code, it appears that the java
object I'm trying to deserialize from the XML is not being created because
it's an instance of a class that implements the Serializable interface.  It
seems as though, a SerializableConverter is being used as opposed to
the AbstractReflectionConverter.

In the DefaultConverterLookup.lookupConverterForType(),
the SerializableConverter is found since it's isSerializable() returns true
after passing the serializationMethodInvoker.supportsReadObject() test. The
object I'm trying to deserialize contains a readObject() in one of it's
parent classes...

Thanks,
Mark
</description>
    <dc:creator>Mark Codere</dc:creator>
    <dc:date>2008-12-01T16:15:39</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5323">
    <title>How to use XSTream to persist a Graph Object??</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5323</link>
    <description>
Hello sir:
I hope to use XStream to persist a Graph object as following example I
googled in website:

1. main program:

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import javax.swing.*;
import javax.swing.event.*;
 
public class Location extends JPanel implements ChangeListener
{
    Ellipse2D.Double ball;
    Line2D.Double    line;
    JSlider          translate;
    double           lastTheta = 0;
 
    public void stateChanged(ChangeEvent e)
    {
        JSlider slider = (JSlider)e.getSource();
        String name = slider.getName();
        int value = slider.getValue();
        if(name.equals("rotation"))
            tilt(Math.toRadians(value));
        else if(name.equals("translate"))
            moveBall(value);
        repaint();
    }
 
    protected void paintComponent(Graphics g)
    {
        super.paintComponent(g);
        Graphics2D g2 = (Graphics2D)g;
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                            RenderingHints.VALUE_ANTIALIAS_ON);
        if(ball == null)
            initGeom();
        g2.setPaint(Color.green.darker());
        g2.draw(line);
        g2.setPaint(Color.red);
        g2.fill(ball);
    }
 
    private void initGeom()
    {
        int w = getWidth();
        int h = getHeight();
        int DIA = 30;
        int padFromEnd = 5;
        line = new Line2D.Double(w/4, h*15/16, w*3/4, h*15/16);
        double x = line.x2 - padFromEnd - DIA;
        double y = line.y2 - DIA;
        ball = new Ellipse2D.Double(x, y, DIA, DIA);
        // update translate slider values
        int max = (int)line.getP1().distance(line.getP2());
        translate.setMaximum(max);
        translate.setValue(max-padFromEnd);
    }
 
    private void tilt(double theta)
    {
        // rotate line from left end
        Point2D pivot = line.getP1();
        double lineLength = pivot.distance(line.getP2());
        Point2D.Double p2 = new Point2D.Double();
        p2.x = pivot.getX() + lineLength*Math.cos(theta);
        p2.y = pivot.getY() + lineLength*Math.sin(theta);
        line.setLine(pivot, p2);
 
        // find angle from pivot to ball center relative to line
        // ie, ball center -&gt; pivot -&gt; line end
        double cx = ball.getCenterX();
        double cy = ball.getCenterY();
        double pivotToCenter = pivot.distance(cx, cy);
        // angle of ball to horizon
        double dy = cy - pivot.getY();
        double dx = cx - pivot.getX();
        // relative angle phi = ball_to_horizon - last line_to_horizon
        double phi = Math.atan2(dy, dx) - lastTheta;
        // rotate ball from pivot
        double x = pivot.getX() + pivotToCenter*Math.cos(theta+phi);
        double y = pivot.getY() + pivotToCenter*Math.sin(theta+phi);
        ball.setFrameFromCenter(x, y, x+ball.width/2, y+ball.height/2);
        lastTheta = theta;  // save theta for next time
    }
 
    private void moveBall(int distance)
    {
        Point2D pivot = line.getP1();
        // ball touches line at distance from pivot
        double contactX = pivot.getX() + distance*Math.cos(lastTheta);
        double contactY = pivot.getY() + distance*Math.sin(lastTheta);
        // find new center location of ball
        // angle lambda = lastTheta - 90 degrees (anti-clockwise)
        double lambda = lastTheta - Math.PI/2;
        double x = contactX + (ball.width/2)*Math.cos(lambda);
        double y = contactY + (ball.height/2)*Math.sin(lambda);
        ball.setFrameFromCenter(x, y, x+ball.width/2, y+ball.height/2);
    }
 
    JPanel getControls()
    {
        JSlider rotate = getSlider("rotation angle", "rotation", -90, 0, 0,
5, 15);
        translate = getSlider("distance from end",  "translate", 0, 100,
100,25, 50);
        JPanel panel = new JPanel(new GridLayout(0,1));
        panel.add(rotate);
        panel.add(translate);
        return panel;
    }
 
    private JSlider getSlider(String title, String name, int min, int max,
                              int value, int minorSpace, int majorSpace)
    {
        JSlider slider = new JSlider(JSlider.HORIZONTAL, min, max, value);
        slider.setBorder(BorderFactory.createTitledBorder(title));
        slider.setName(name);
        slider.setPaintTicks(true);
        slider.setMinorTickSpacing(minorSpace);
        slider.setMajorTickSpacing(majorSpace);
        slider.setPaintLabels(true);
        slider.addChangeListener(this);
        return slider;
    }
 
    public static void main(String[] args)
    {
        Location test = new Location();
        JFrame f = new JFrame();
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.getContentPane().add(test);
        f.getContentPane().add(test.getControls(), "Last");
        f.setSize(400,400);
        f.setLocation(200,200);
        f.setVisible(true);
    }
}


OK, 
1. I hope After I run it, I made some changes on the picture such as:
rotation angle is -45 degree; Distance from the end is 100;
I hope to save this CURRENT state into an XML file and save it to disk;
2. then next time I open it, I can read this XML file from disk, and recover
whole picture I saved before: rotation angle is -45 degree; Distance from
the end is 100;

How to use XStream to do this??


Thanks

</description>
    <dc:creator>sunnymanman</dc:creator>
    <dc:date>2008-12-01T03:38:10</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5321">
    <title>Custom Mapper</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5321</link>
    <description>How do you add a custom mapper to xstream object?  Is this only possible
via adding a custom converter?  Code examples will be much appreciated.

Thanks,



</description>
    <dc:creator>Wu, Calvin (Technology</dc:creator>
    <dc:date>2008-11-28T11:51:21</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5318">
    <title>CannotResolveClassException in java 1.6</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5318</link>
    <description>We’re using a custom SingleValueConverter to handle &lt;Category&gt;test&lt;/Category&gt;. 
It works fine on java 1.5, but getting CannotResolveClassException on java 1.6.  

com.thoughtworks.xstream.mapper.CannotResolveClassException:
[Lcom.test.Category; : [Lcom.test.Category;

Has anyone experienced this problem before?

Thanks,



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



</description>
    <dc:creator>Calvin Wu</dc:creator>
    <dc:date>2008-11-28T05:24:10</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5316">
    <title>CannotResolveClassException</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5316</link>
    <description>We're using a custom SingleValueConverter to handle
&lt;Category&gt;test&lt;/Category&gt;.  It works fine on one linux platform, but
getting CannotResolveClassException on the other.  

com.thoughtworks.xstream.mapper.CannotResolveClassException:
[Lcom.test.Category; : [Lcom.test.Category;

It looks like it's failing in the realClass method of DefaultMapper:

    public Class realClass(String elementName) {
        try {
            return classLoader.loadClass(elementName);
        } catch (ClassNotFoundException e) {
            throw new CannotResolveClassException(elementName + " : " +
e.getMessage());
        }
    }  

The classLoader is trying to load "[Lcom.test.Category;" when it should
be loading "com.test.Category" instead.

Why is this happening?  

Thanks,
</description>
    <dc:creator>Wu, Calvin (Technology</dc:creator>
    <dc:date>2008-11-28T00:17:57</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5307">
    <title>Problem deserializing</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5307</link>
    <description>The result of the xstream.fromXml is always null, and I don't understand wh= y, any clues ?

Server response:
&lt;Response&gt;
      &lt;Error Type=3D"String" Value=3D"Access to file denied /etc/svninfo.tx= t"/&gt; &lt;/Response&gt;

This is the code I call for deserialization:

XStream xstream =3D new XStream();
xstream.processAnnotations(AsdfErrorResponse.class);
response =3D (AsdfErrorResponse) xstream.fromXML(xml);

This is the detail of my classes:

package com.comact.net.asdf.response.impl;

import com.comact.net.asdf.dto.AsdfError;
import com.comact.net.asdf.dto.ValueType;
import com.comact.net.asdf.response.AsdfResponse;
import com.thoughtworks.xstream.annotations.XStreamAlias;

&lt; at &gt;XStreamAlias("Response")
public class AsdfErrorResponse implements AsdfResponse {
      private AsdfError error;

      public AsdfErrorResponse() {
      }

      public AsdfErrorResponse(AsdfError error) {
            this.error =3D error;
      }

      public AsdfErrorResponse(String message){
            error =3D new AsdfError(ValueType.TYPE_STRING, message);
      }

      public AsdfError getError() {
            return error;
      }

      public void setError(AsdfError error) {
            this.error =3D error;
      }

      public String getMessage() {
            return error.getValue();
      }

      public State getResponseState(){
            return State.ERROR;
      }
}

package com.comact.net.asdf.dto;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;

&lt; at &gt;XStreamAlias("Error")
public class AsdfError implements ValueType {

      // Required by the Asdf server.
      &lt; at &gt;XStreamAlias("Type")
      &lt; at &gt;XStreamAsAttribute
      private String type;

      &lt; at &gt;XStreamAlias("Value")
      &lt; at &gt;XStreamAsAttribute
      private String value;

      public AsdfError() {
      }

      public AsdfError(String type, String value) {
            this.type =3D type;
            this.value =3D value;
      }

      public String getType() {
            return type;
      }

      public void setType(String type) {
            this.type =3D type;
      }

      public String getValue() {
            return value;
      }

      public void setValue(String value) {
            this.value =3D value;
      }
}

Thanks for your replies.

Pascal Lalonde
Technicien de service / Développeur logiciel / Test
plalonde-wZzq7PZe3JrQT0dZR+AlfA&lt; at &gt;public.gmane.org&lt;mailto:&gt;
COMACT
Équipements Comact Inc.
3675 boul. de la Grande-Allée, Boisbriand (Québec) J7H 1H5
Tél: 450 435 2121 x 296
Fax: 450 430 3407

</description>
    <dc:creator>Pascal Lalonde</dc:creator>
    <dc:date>2008-11-27T18:11:34</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5305">
    <title>RegisterLocalConverter Priority</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5305</link>
    <description>Hi,
I have implemented an custom date converter which implements 
SingleValueConverter. I have also created the DateConverterWrapper which 
extends SingleValueConverterWrapper.
Then I have used annotations on a class called Transaction

&lt; at &gt;XStreamAlias("Transaction")
public class Transaction implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = -4068970037592154030L;
    &lt; at &gt;XStreamAsAttribute   
    &lt; at &gt;XStreamConverter(DateConverterWrapper.class)   
    &lt; at &gt;XStreamAlias("date")   
    private Date date;
    &lt; at &gt;XStreamAsAttribute   
    private String action;
    &lt; at &gt;XStreamAsAttribute   
    private String merchantTransactionId;
  ....
}

However, I found that the custom converter is never called unless I 
remove the &lt; at &gt;XStreamAsAttribute annotation.
If I register the Converter as global converter, then the date is 
converted using the custom converter and output as attribute.
However I don't want this customized converter in global scope. Is there 
any ways to do this?

Thanks,
Andy

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



</description>
    <dc:creator>Andy Yeung</dc:creator>
    <dc:date>2008-11-27T13:21:10</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5303">
    <title>Converting XML to Java Objects</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5303</link>
    <description>
I have an XML file that looks something like this:

&lt;block a="0" b="6"&gt;
    &lt;data1 id="0"&gt;
      &lt;columns&gt;
        &lt;column name="name0" order="0"/&gt;
        &lt;column name="name1" order="1"/&gt;
      &lt;/columns&gt;
    &lt;/data1&gt;
    &lt;data1 id="1"&gt;
      &lt;columns&gt;
        &lt;column name="name0" order="0"/&gt;
        &lt;column name="name1" order="1"/&gt;
      &lt;/columns&gt;
    &lt;/data1&gt;
&lt;/block&gt;
&lt;block a="0" b="6"&gt;
    &lt;data2 id="0"&gt;
      &lt;columns&gt;
        &lt;column name="name0" order="0"/&gt;
        &lt;column name="name1" order="1"/&gt;
      &lt;/columns&gt;
    &lt;/data2&gt;
    &lt;data2 id="1"&gt;
      &lt;columns&gt;
        &lt;column name="name0" order="0"/&gt;
        &lt;column name="name1" order="1"/&gt;
      &lt;/columns&gt;
    &lt;/data2&gt;
&lt;/block&gt;


So a block can either contain a list of data1 or data2 "objects". A block
cannot contain both "objects" in the same "scope". When I want to create a
class that this XML file can be converted to I do:

class block {

private List&lt;data1&gt; d1;
private List&lt;data2&gt; d2;
...
(where data1 and data2 are separate objects).

But when I convert the block class back to XML I get something like:

&lt;block a="0" b="6"&gt;
    &lt;data1 id="0"&gt;
      &lt;columns&gt;
        &lt;column name="name0" order="0"/&gt;
        &lt;column name="name1" order="1"/&gt;
      &lt;/columns&gt;
    &lt;/data1&gt;
    &lt;data1 id="1"&gt;
      &lt;columns&gt;
        &lt;column name="name0" order="0"/&gt;
        &lt;column name="name1" order="1"/&gt;
      &lt;/columns&gt;
    &lt;/data1&gt;
    &lt;data2 id="0"&gt;
      &lt;columns&gt;
        &lt;column name="name0" order="0"/&gt;
        &lt;column name="name1" order="1"/&gt;
      &lt;/columns&gt;
    &lt;/data2&gt;
    &lt;data2 id="1"&gt;
      &lt;columns&gt;
        &lt;column name="name0" order="0"/&gt;
        &lt;column name="name1" order="1"/&gt;
      &lt;/columns&gt;
    &lt;/data2&gt;
&lt;/block&gt;



As can be seen both data1 and data2 are contained within the same block! How
do I separate data1 and data2 in separate blocks without having to make two
different block classes?

</description>
    <dc:creator>bigblop</dc:creator>
    <dc:date>2008-11-26T18:33:18</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5298">
    <title>Tag Getting Repeated Again</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5298</link>
    <description>Hi all,

I am new to the world of XStream, I am using it to create an XML file but
facing a problem. i have created a simple bean class with getter and setter
method in it and another class for creating XML with the help of this bean

below is the code snap shot of both the xml classes and generated XML

*

public* *class* Test {
*

private* String userName=*null*;
*

private* String emailID=*null*;
*

private* String empID=*null*;
*

private* *int* age=0;


*

package* xml;

*

import* com.thoughtworks.xstream.XStream;

*

public* *class* XMLTest {

*public* *static* *void* main(String [] args){

XStream xStream=*new* XStream();

xStream.alias("Test",Test.*class*);

*int* temp_size = 2;

Test [] test=*new* Test[3];

*for*(*int* i=0;i&lt;test.length; i++){

*for*(*int* j=i; j&lt;temp_size; j++){

Test tempTest=*new* Test();

tempTest.setAge(25);

tempTest.setEmailID("aum-tI++9R+HGckAvxtiuMwx3w&lt; at &gt;public.gmane.org");

tempTest.setEmpID("0152"+j);

tempTest.setUserName("Aum" +j);

test[i]=tempTest;

}

String xml=xStream.toXML(test);

System.*out*.println(xml);

}

 }

}



and the generated XML is:



&lt;Test-array&gt;

&lt;Test&gt;

&lt;userName&gt;Aum1&lt;/userName&gt;

&lt;emailID&gt;aum-tI++9R+HGckAvxtiuMwx3w&lt; at &gt;public.gmane.org&lt;/emailID&gt;

&lt;empID&gt;01521&lt;/empID&gt;

&lt;age&gt;25&lt;/age&gt;

&lt;/Test&gt;

&lt;null/&gt;

&lt;null/&gt;

&lt;/Test-array&gt;

&lt;Test-array&gt;

&lt;Test&gt;

&lt;userName&gt;Aum1&lt;/userName&gt;

&lt;emailID&gt;aum-tI++9R+HGckAvxtiuMwx3w&lt; at &gt;public.gmane.org&lt;/emailID&gt;

&lt;empID&gt;01521&lt;/empID&gt;

&lt;age&gt;25&lt;/age&gt;

&lt;/Test&gt;

&lt;Test&gt;

&lt;userName&gt;Aum1&lt;/userName&gt;

&lt;emailID&gt;aum-tI++9R+HGckAvxtiuMwx3w&lt; at &gt;public.gmane.org&lt;/emailID&gt;

&lt;empID&gt;01521&lt;/empID&gt;

&lt;age&gt;25&lt;/age&gt;

&lt;/Test&gt;

&lt;null/&gt;

&lt;/Test-array&gt;

&lt;Test-array&gt;

&lt;Test&gt;

&lt;userName&gt;Aum1&lt;/userName&gt;

&lt;emailID&gt;aum-tI++9R+HGckAvxtiuMwx3w&lt; at &gt;public.gmane.org&lt;/emailID&gt;

&lt;empID&gt;01521&lt;/empID&gt;

&lt;age&gt;25&lt;/age&gt;

&lt;/Test&gt;

&lt;Test&gt;

&lt;userName&gt;Aum1&lt;/userName&gt;

&lt;emailID&gt;aum-tI++9R+HGckAvxtiuMwx3w&lt; at &gt;public.gmane.org&lt;/emailID&gt;

&lt;empID&gt;01521&lt;/empID&gt;

&lt;age&gt;25&lt;/age&gt;

&lt;/Test&gt;

&lt;null/&gt;

&lt;/Test-array&gt;

but in the generated XML it is repeated &lt;Test-array&gt;, but i want that it
should be only one time i mean the parent tag.

can any body help me what i have done wrong



thanks in advanve

umesh
</description>
    <dc:creator>shekher thakur</dc:creator>
    <dc:date>2008-11-25T11:21:45</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5294">
    <title>How to add Attributes to XML Element while creating XML from Java Object</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5294</link>
    <description>Hi,
  I am new to XStream. I need to know how to create an Attribute for a XML 
element. I am creating XML from Java beans. Here is what I am trying - 

&lt;Person xmlns="http://"&gt;
  &lt;name type="abc"&gt;Rick&lt;/name&gt;
  &lt;gender&gt;male&lt;/gender&gt;
&lt;/person&gt;

I have a java bean class Person.java - 

public class Person {
    private String name;
    private String gender;
    private final String xmlns = "http://";

    public Person(String name, String gender) {
        this.name = name;
        this.gender = gender;
    }
    
    --Getter and Setter Methods for properties--
}

In my main class - 

   XStream xStream = new XStream();
   Person person = new Person("Rick", "male");
   xStream.useAttributeFor(Person.class, "xmlns");
   String xml = xStream.toXml(person);

This generate the XML with out the "type" attribute for name. I am not sure how 
to add the attribute to a String inside Person class. Please help and advise.

Thanks for your help.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



</description>
    <dc:creator>Rick Pats</dc:creator>
    <dc:date>2008-11-24T19:47:21</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5285">
    <title>How to get ObjectGraph?</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5285</link>
    <description>
Hi,

I want to get the object graph maybe from serialized object or
maybe object in memory.

The target of getting such an object graph is to build 
a Jtree representing the object with all its graph
for visualization and maybe later some processing.

Does Xstream provides any public function which returns
the objectgraph of any object passed as an argument?
</description>
    <dc:creator>rmahmood</dc:creator>
    <dc:date>2008-11-24T09:59:35</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5283">
    <title>[JSON ERROR]</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5283</link>
    <description>Hello Guys

I believe there is something wrong with JettisonMappedXmlDriver while
dealing with collections.

I have the following Java class:

public class State extends com.orion.model.Model {
    private Integer id;
    private String name;
    private Country country;
    private List&lt;Country&gt; values;

    ....
}

But when I use the JSON driver, It is putting the collection values on the
root instead of keeping it inside of the State object.

As you can see, on XML it all works great:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;list&gt;
  &lt;state id="1" name="Parana"&gt;
    &lt;country id="1" name="Brazil"/&gt;
    &lt;values&gt;
      &lt;country id="0"/&gt;
      &lt;country id="1"/&gt;
    &lt;/values&gt;
  &lt;/state&gt;
  &lt;state id="2" name="Santa Catarina"&gt;
    &lt;country id="1" name="Brazil"/&gt;
    &lt;values&gt;
      &lt;country id="0"/&gt;
      &lt;country id="1"/&gt;
    &lt;/values&gt;
  &lt;/state&gt;
&lt;/list&gt;


Here is what I'm getting with the JSON driver:

{"list":{"state":{"id":1,"name":"Parana","country":[{"id":1,"name":"Brazil"},{"id":0}],"values":{}},"country":{"id":1}},"state":{"id":2,"name":"Santa
Catarina","country":[{"id":1,"name":"Brazil"},{"id":0}],"values":{}},"country":{"id":1}}

As you can see, the 'values' collection does not contain any value and
somehow ends up on the root of the list document as 'country'.

If i use JsonHierarchicalStreamDriver it seems also works fine but it does
not solve my problem since I need full serialization/deserialization.

Here is a sample of JsonHierarchicalStreamDriver:

{"list": [
  {
    "id": 1,
    "name": "Parana",
    "country": {
      "id": 1,
      "name": "Brazil"
    },
    "values": [
      {
        "id": 0
      },
      {
        "id": 1
      }
    ]
  },
  {
    "id": 2,
    "name": "Santa Catarina",
    "country": {
      "id": 1,
      "name": "Brazil"
    },
    "values": [
      {
        "id": 0
      },
      {
        "id": 1
      }
    ]
  }
]}

Could this be some kind of bug or am I missing something?

Regards,
</description>
    <dc:creator>João Kreuzberg</dc:creator>
    <dc:date>2008-11-24T07:08:15</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5282">
    <title>Graham Little is out of the office.</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5282</link>
    <description>
I will be out of the office starting  24/11/2008 and will not return until
25/11/2008.

Please email SCEE PD SCERT ACWCE for urgent ACWCE issues


**********************************************************************
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify postmaster-xA9K9HnoQaU&lt; at &gt;public.gmane.org
This footnote also confirms that this email message has been checked
for all known viruses.
Sony Computer Entertainment Europe Limited
Registered Office: 10 Great Marlborough Street, London W1F 7LP, United Kingdom
Registered in England:3277793
**********************************************************************

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



</description>
    <dc:creator>Graham_Little-xA9K9HnoQaU&lt; at &gt;public.gmane.org</dc:creator>
    <dc:date>2008-11-24T07:00:24</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.java.xstream.user/5273">
    <title>How can I use XStream to persist only customer objects??</title>
    <link>http://comments.gmane.org/gmane.comp.java.xstream.user/5273</link>
    <description>
Dear Friends:
How can I use XStream to persist only customer objects??
when I use XStream to persist an GUI object, It save all java standard
classes such as JPane, JButton, JLabel etc, it takes a lot of space, But I
did not want XStream to store all common API classes, I only hope it
persists the classes I created, 
How can I do that??
Any Example??(includes serialize and deserialize)
Thanks

Sunny
</description>
    <dc:creator>sunnymanman</dc:creator>
    <dc:date>2008-11-22T02:26:55</dc:date>
  </item>
  <textinput about="http://search.gmane.org/?group=$group=gmane.comp.java.xstream.user">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.java.xstream.user</link>
  </textinput>
</rdf:RDF>
