Hi Jorg

thank you for comming back to me. I believe i miss lead you. my problem in
not in the test, the problem that am talking about is related to the fact
that the i cannot get the members of the Custom object to be populated, the
problem is inside the Unmarshal function, if i look at the example of the
Tutorial

http://xstream.codehaus.org/converter-tutorial.html

I dont seem to get it right, i have tried several things, some of them i
get an exception about missing class members, sometimes it gives the
exception about "only the Start_tag can have attributes"

this is the piece of code that i am talking about

================= %< ======================

 case TypeOne: {
                            reader.moveUp();
                            ExtendedTypeOne extendedTypeOne = new
ExtendedTypeOne();
                            extendedTypeOne = (ExtendedTypeOne)
uc.convertAnother(extendedTypeOne, ExtendedTypeOne.class);
                            reader.moveDown();
                        }

================= %< ======================

This is the problem that i am facing,

Thank you in Advance
Cheers


On Sat, Nov 17, 2012 at 1:26 PM, Jörg Schaible <[email protected]>wrote:

> Hi Ruben,
>
> Ruben Fragoso wrote:
>
> > Thank you Jorg for coming back to me
> >
> > well i just wrote a bit of the code, to give an example
> >
> > you can see the full example in this link
> >
> > https://docs.google.com/open?id=0B8TCL6GRojyLbzVYckZ2cEpWOUE
> >
> > so you can navigate without downloading it
> >
> > it is very small project 8kb.
> >
> > I would greatly appreciated if you gave a look
>
> [snip]
>
> >> > The problem is that the object that i  get in return is completly
> >> > empty?
> >> >
> >> > Could please let me know what is wrong my my code?
>
> ================= %< ======================
> MyCustomObject customObject = new MyCustomObject();
> try {
>   File file = new File("target" + File.separator + "test.xml");
>   FileInputStream fis = new FileInputStream(file);
>   xmlTransformer.fromXML(fis, customObject);
> } catch (FileNotFoundException ex) {
> }
> ================= %< ======================
>     public Object unmarshal(HierarchicalStreamReader reader,
> UnmarshallingContext uc) {
>         MyCustomObject returnValue = new MyCustomObject();
> [snip]
>         return returnValue;
>     }
>
> ================= %< ======================
>
> Because your converter uses a new MyCustomOject instead the one you have
> provided (uc.currentObject()) and your test method ignores the returned new
> instance. Actually you should never provide the root object for
> unmarshalling unless you really know what you're doing. The "Use with
> care!"
> hint in the javadoc is for a reason.
>
> Cheers,
> Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>

Reply via email to