commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Josef Wagner" <JosefWag...@web.de>
Subject Reading Java Plain Objects (OJB) From XML
Date Fri, 06 Jan 2006 14:24:47 GMT
Hello,
I want do read different Beans from only ONE XML-Stream like this.
On the Homepage, I have only found an example with One Bean per StringReader
:o(...


I want to do the following:
1. Writing different Beans in a Stream

beanWriter.write("myBean1", new MyBean1());
beanWriter.write("myBean2", new MyBean2());
beanWriter.write("myBean3", new MyBean3());

2. Reading the different Beans from the written stream

beanReader.registerBeanClass("myBean1", MyBean1.class);
MyBean1 myBean1 = (MyBean1) beanReader.parse(xmlReader);

beanReader.registerBeanClass("myBean2", MyBean2.class);
MyBean2 myBean2 = (MyBean2) beanReader.parse(xmlReader);

beanReader.registerBeanClass("myBean3", MyBean3.class);
MyBean3 myBean3 = (MyBean3) beanReader.parse(xmlReader);

This way ends in Exceptions. When I write and read only one Bean, all works
fine. Isn't it possible to have more Beans in the XML output?

My second problem is that at this time I haven't the information, which tipe
of Bean (MyBean1, MyBean2, MyBean3) comes as returnvalue, when starting
"beanReader.parse(xmlReader);"

Thanks a lot for help
Josef Wagner (Germany)



-----Ursprüngliche Nachricht-----
Von: dhmspam-betwixt@yahoo.com.ar [mailto:dhmspam-betwixt@yahoo.com.ar] 
Gesendet: Mittwoch, 4. Januar 2006 13:49
An: Jakarta Commons Users List
Betreff: Re: Converting Java Plain Objects (OJB) to XML

Hallo

(excuse my english, but I am an spanish speaker)

You should map each POJO in dot-betwixt file.
if you use the addDefaults tag, use the "hide" tag to
ignore the properties that you don't want to be
mapped.
If not, just map the properties that you want to be
writed

I hope that it helps

Bye!




 --- Josef Wagner <JosefWagner@web.de> escribió:

> Hello Users,
> 
>  
> 
> I wan't to convert my ojb plain java classes to XML.
> I tried to do this with
> betwixt. When I do this like in the example on the
> Homepage, betwixt
> converts also the referenzed objects to xml. I only
> want, that betwixt
> converts the primitives types (attributes like
> integer, string.) of the
> current class and not the referenced objects. I
> haven't found a flag to
> configure this yet.
> 
>  
> 
> Any idea?
> 
>  
> 
> Thanks a lot
> 
>  
> 
> Josef Wagner
> 
> 


Ing. Diego H. Mornacco
Epidata Consulting S.R.L. <EPI/>
www.epidataconsulting.com
Cel: 15-5884-0040


"K.I.S.S.: Keep It Simple, S...!"


    


    
        
___________________________________________________________ 
1GB gratis, Antivirus y Antispam 
Correo Yahoo!, el mejor correo web del mundo 
http://correo.yahoo.com.ar 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message