here is an example of the message that i get

only START_TAG can have attributes END_TAG seen ... <MyCustomObject
widht="23" type="TypeOne" name="One" heigh="23"/>... @3:68 : only START_TAG
can have attributes END_TAG seen ... <MyCustomObject widht="23"
type="TypeOne" name="One" heigh="23"/>... @3:68



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