Re: [Simple-support] Atabaque DTDtoBean Tool
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2007-06-19 12:27:39
|
Hi,=0A=0AI tried to find it at http://sf.net/projects/atabaque but later re= alized that it was located at http://sourceforge.net/projects/dtdtobean/, c= an it work with Eclipse?=0A=0ANiall=0A=0A----- Original Message ----=0AFrom= : Serge Rehem <ser...@gm...>=0ATo: sim...@li...= e.net=0ASent: Monday, June 18, 2007 10:03:37 PM=0ASubject: [Simple-support]= Atabaque DTDtoBean Tool=0A=0AHi Everybody!!!=0A=0ATired to write Java Bean= s by hand? =0A=0ASee the first beta version of Atabaque DTDtoBean, that gen= erates JavaBeans from an specified DTD=0Afile. You can choose generate stan= dard Java Beans or using Annotations=0Afor Simple or XStream. It=B4s availa= ble as a=0Acommand line, Swing application or NetBeans plugin.=0A=0A=0A=0A= =0AThis project was started from a necessity of Atabaque=0Aproject, so that= =B4s the reason for using Atabaque DTDtoBean name. =0A=0A=0AHope you enjoy = and contribute to it!=0A=0A[]=B4s=0ASerge Rehem=0A=0A2007/6/14, simple-supp= ort...@li...=0A <sim...@li...= rge.net>:=0ASend Simple-support mailing list submissions to=0A simpl= e-s...@li...=0A=0ATo subscribe or unsubscribe via the Wo= rld Wide Web, visit=0A=0A https://lists.sourceforge.net/lists/listin= fo/simple-support=0Aor, via email, send a message with subject or body 'hel= p' to=0A =0As...@li...=0A=0AYou ca= n reach the person managing the list at=0A =0Asimple-support-owner@l= ists.sourceforge.net=0A=0AWhen replying, please edit your Subject line so i= t is more specific=0Athan "Re: Contents of Simple-support digest..."=0A=0A= =0AToday's Topics:=0A=0A=0A 1. Re: Element/Attribute Default Values (Nial= l Gallagher)=0A 2. Re: Element/Attribute Default Values (Keith Byrne)=0A= =0A=0A---------------------------------------------------------------------= -=0A=0AMessage: 1=0A=0ADate: Wed, 13 Jun 2007 12:44:05 -0700 (PDT)=0AFrom: = Niall Gallagher <gal...@ya...>=0ASubject: Re: [Simple-support]= Element/Attribute Default Values=0ATo: Niall Gallagher <=0Agallagher_niall= @yahoo.com>, Keith Byrne=0A <ka...@gm...>, =0Asimple-su= pp...@li...=0AMessage-ID: <327...@we...= d.yahoo.com>=0AContent-Type: text/plain; charset=3D"us-ascii"=0A=0A=0AHi,= =0A=0ASimple 1.3.1 has been release with support for null @Attribute and @T= ext values. This means that within the XML document the Java null value can= be represented in a textual manner within the XML document. For example ta= ke the following:=0A=0A=0A@Root=0Apublic class Example {=0A=0A @Attribute= (empty=3D"NULL")=0A private String name;=0A=0A @Text(empty=3D"NO TEXT H= ERE")=0A private String value;=0A=0A public Example() {=0A super()= ;=0A=0A }=0A=0A public Example(String name, String value) {=0A thi= s.name =3D name;=0A this.value =3D value;=0A }=0A}=0A=0ASo if Persis= ter.write was used on various instances of the Example class the output wou= ld look like follows:=0A=0A=0A1) new Example(null, null)=0A=0A<example name= =3D"NULL>NO TEXT HERE</example>=0A=0A2) new Example("Some Name", null)=0A= =0A<example name=3D"Some Name">NO TEXT HERE</example>=0A=0A=0A3) new Exampl= e("Some Name", "Some Description")=0A=0A<example name=3D"Some Name">Some De= scription</example>=0A=0ADeserialization will ensure that fields with the n= ull text value will be assigned null. I have not yet had time to add suppor= t for null @Element, @ElementArray, or @ElementList.=0A=0A=0ANiall=0A=0A---= -- Original Message ----=0AFrom: Niall Gallagher <gal...@ya...= >=0ATo: Niall Gallagher <=0Ag...@ya...>; Keith Byrne <kabyrn= e...@gm...>; sim...@li...=0ASent: Tuesday, June 12= , 2007 10:36:56 AM=0A=0ASubject: Re: [Simple-support] Element/Attribute Def= ault Values=0A=0AHi,=0A=0AIn future I hope to add an "empty" attribute to a= ll of the annotations such that empty values can be inserted without having= to bend over backwards to cope with null values. Ill be implementing somet= hing like=0A=0A=0A@Root=0Apublic class MyClass {=0A=0A @Attribute(empty= =3D"NULL")=0A private String example;=0A}=0A=0ASuch that if the field "ex= ample" had a null value it would be written as follows:=0A=0A=0A<myClass ex= ample=3D"NULL"/>=0A=0AThe deserialization process will know to substitute t= he specified value with null when reconstituting the object. For the @Eleme= nt, @ElementList, and @ElementArray annotations the field will be a boolean= like so:=0A=0A=0A@Root=0Apublic class MyOtherClass=0A {=0A=0A @ElementLi= st(empty=3Dtrue)=0A private Collection<String> list;=0A}=0A=0AThe above a= nnotation tells the persister to serialize the empty value such that the re= sult of having a null list would be:=0A=0A=0A<myOtherClass>=0A <list/>=0A= </myOtherClass>=0A=0AWhere as if the annotation was set not to write an emp= ty value the resulting XML would be:=0A=0A<myOtherClass/>=0A=0AThis require= s only very minor changes, so will probably make it in soon enough.=0A=0A= =0ANiall=0A=0A----- Original Message ----=0AFrom: Niall Gallagher <gallaghe= r_...@ya...>=0ATo: Keith Byrne <ka...@gm...=0A>; simple-support= @lists.sourceforge.net=0ASent: Monday, June 11, 2007 10:38:52 PM=0ASubject:= Re: [Simple-support] Element/Attribute Default Values=0A=0A=0AHi,=0A=0AYes= there is a way to intercept, for example:=0A=0Apublic class MyExample {=0A= =0A private static final DEFAULT_VALUE =3D "[[NULL]]";=0A @Element=0A priv= ate String webAddress=0A=0A @Commit=0A private void resolveMyDefault() {= =0A=0A if(webAddress.equals(DEFAULT_VALUE)) {=0A webAddress =3D = null;=0A }=0A }=0A=0A @Persist=0A private void fixMyObject() {=0A = if(webAddress =3D=3D null){=0A webAddress =3D DEFAULT_VALUE:=0A= =0A }=0A }=0A=0A @Complete=0A=0A private void backToNormal() {=0A = resolveMyDefault();=0A }=0A}=0A=0AThis should do the trick, as @Pers= ist gets called just before the object is persisted, and @Complete gets cal= led when its been serialized to the XML document. The @Commit gets called a= fter deserialization so the object values will be reverted to a proper work= ing runtime value.=0A=0A=0AHope this helps.=0ANiall=0A=0A----- Original Mes= sage ----=0AFrom: Keith Byrne <ka...@gm...>=0ATo: simple-support@list= s.sourceforge.net=0A=0ASent: Monday, June 11, 2007 10:33:16 AM=0ASubject: [= Simple-support] Element/Attribute Default Values=0A=0A=0AI have a situation= where a field isn't required, but when it's null and is serialized, the ta= g still needs to show up empty. Specifically, there is a String field (web= Address) that has an Attribute annotation, that went it's null=0A=0A should= be serialized to <webAddress/>, instead of not showing up. Is there a way= to intercept the serializing of an Element/Attribute, and based upon it's = type, serialize a default value?=0A=0A=0A----------------------------------= ---------------------------------------=0A=0AThis SF.net email is sponsored= by DB2 Express=0ADownload DB2 Express C - the FREE version of DB2 express = and take=0Acontrol of your XML. No limits. Just data. Click to get it now.= =0A=0Ahttp://sourceforge.net/powerbar/db2/=0A______________________________= _________________=0ASimple-support mailing lis...@li...= ceforge.net=0A=0Ahttps://lists.sourceforge.net/lists/listinfo/simple-suppor= t=0A=0A=0A=0A=0A=0A=0A=0A Shape Yahoo! in your own image.=0AJoin our N= etwork Research Panel today!=0A=0A-----------------------------------------= --------------------------------=0AThis SF.net email is sponsored by DB2 Ex= press=0ADownload DB2 Express C - the FREE version of DB2 express and take= =0Acontrol of your XML. No limits. Just data. Click to get it now.=0A=0Ahtt= p://sourceforge.net/powerbar/db2/=0A_______________________________________= ________=0ASimple-support mailing lis...@li...= e.net=0Ahttps://lists.sourceforge.net/lists/listinfo/simple-support=0A=0A= =0A=0A=0A=0A=0A=0A Got a little couch potato?=0A=0A=0ACheck out fun su= mmer activities for kids.=0A=0A=0A=0A=0A=0A=0A_____________________________= _______________________________________________________=0ALooking for a dea= l? Find great prices on flights and hotels with Yahoo! FareChase.=0A=0Ahttp= ://farechase.yahoo.com/=0A-------------- next part --------------=0AAn HTML= attachment was scrubbed...=0A=0A------------------------------=0A=0AMessag= e: 2=0ADate: Thu, 14 Jun 2007 12:16:06 -0400=0A=0AFrom: "Keith Byrne" <kaby= rn...@gm...>=0ASubject: Re: [Simple-support] Element/Attribute Default Va= lues=0ATo: "Niall Gallagher" <=0Ag...@ya...>=0ACc: simple-su= pp...@li...=0AMessage-ID:=0A <=0A5336fd4d0706140916w= 558...@ma...>=0AContent-Type: text/plain; chars= et=3D"iso-8859-1"=0A=0AThanks, this is great. I look forward to the suppor= t the @Element=0Aannotations.=0A=0A=0AOn 6/13/07, Niall Gallagher <gallaghe= r_...@ya...> wrote:=0A>=0A> Hi,=0A>=0A> Simple 1.3.1 has been release= with support for null @Attribute and @Text=0A=0A> values. This means that = within the XML document the Java null value can be=0A> represented in a tex= tual manner within the XML document. For example take=0A> the following:=0A= >=0A> @Root=0A> public class Example {=0A=0A>=0A> @Attribute(empty=3D"NU= LL")=0A> private String name;=0A>=0A> @Text(empty=3D"NO TEXT HERE")= =0A> private String value;=0A>=0A> public Example() {=0A> super= ();=0A=0A> }=0A>=0A> public Example(String name, String value) {=0A> = this.name =3D name;=0A> this.value =3D value;=0A> }=0A> }=0A= >=0A> So if Persister.write=0A was used on various instances of the Example= class=0A> the output would look like follows:=0A>=0A> 1) new Example(null,= null)=0A>=0A> <example name=3D"NULL>NO TEXT HERE</example>=0A>=0A=0A> 2) n= ew Example("Some Name", null)=0A>=0A> <example name=3D"Some Name">NO TEXT H= ERE</example>=0A>=0A> 3) new Example("Some Name", "Some Description")=0A=0A= >=0A> <example name=3D"Some Name">Some Description</example>=0A>=0A> Deseri= alization will ensure that fields with the null text value will be=0A> assi= gned null. I have not yet had time to add support for null @Element,=0A=0A>= @ElementArray, or @ElementList.=0A>=0A> Niall=0A>=0A> ----- Original Messa= ge ----=0A> From: Niall Gallagher <gal...@ya...>=0A=0A> To: Ni= all Gallagher <gal...@ya...>; Keith Byrne <=0A> kabyrne@gmail.= com>; =0As...@li...=0A> Sent: Tuesday, June 12, 2= 007 10:36:56 AM=0A> Subject: Re: [Simple-support] Element/Attribute Default= Values=0A>=0A> Hi,=0A>=0A> In future I hope to add an "empty" attribute to= all of the annotations=0A=0A> such that empty values can be inserted witho= ut having to bend over backwards=0A> to cope with null values. Ill be imple= menting something like=0A>=0A> @Root=0A> public class MyClass {=0A>=0A> = @Attribute(empty=3D"NULL")=0A=0A> private String example;=0A> }=0A>=0A> = Such that if the field "example" had a null value it would be written as=0A= > follows:=0A>=0A> <myClass example=3D"NULL"/>=0A=0A>=0A> The deserializati= on process will know to substitute the specified value=0A> with null when r= econstituting the object. For the @Element, @ElementList,=0A> and @ElementA= rray annotations the field will be a boolean like so:=0A=0A>=0A> @Root=0A> = public class MyOtherClass {=0A>=0A> @ElementList(empty=3Dtrue)=0A> pr= ivate Collection<String> list;=0A> }=0A>=0A> The above annotation tells the= persister to serialize the empty value such=0A=0A> that the result of havi= ng a null list would be:=0A>=0A> <myOtherClass>=0A> <list/>=0A> </myOthe= rClass>=0A>=0A> Where as if the annotation was set not to write an empty va= lue the=0A=0A> resulting XML would be:=0A>=0A> <myOtherClass/>=0A>=0A> This= requires only very minor changes, so will probably make it in soon=0A> eno= ugh.=0A>=0A> Niall=0A>=0A> ----- Original Message ----=0A=0A> From: Niall G= allagher <gal...@ya...>=0A> To: Keith Byrne <ka...@gm...= >; =0As...@li...=0A> Sent: Monday, June 11, 2007 = 10:38:52 PM=0A> Subject: Re: [Simple-support] Element/Attribute Default Val= ues=0A>=0A> Hi,=0A>=0A> Yes there is a way to intercept, for example:=0A=0A= >=0A> public class MyExample {=0A>=0A> private static final DEFAULT_VALUE = =3D "[[NULL]]";=0A> @Element=0A> private String webAddress=0A>=0A> @Co= mmit=0A> private void resolveMyDefault() {=0A=0A> if(webAddress.equa= ls(DEFAULT_VALUE)) {=0A> webAddress =3D null;=0A> }=0A> }=0A>= =0A> @Persist=0A> private void fixMyObject() {=0A> if(webAddress= =3D=3D null){=0A=0A> webAddress =3D DEFAULT_VALUE:=0A> }=0A= > }=0A>=0A> @Complete=0A> private void backToNormal() {=0A> = resolveMyDefault();=0A> }=0A> }=0A>=0A> This should do the trick, as @Pe= rsist gets called just before the object=0A=0A> is persisted, and @Complete= gets called when its been serialized to the XML=0A> document. The @Commit = gets called after deserialization so the object values=0A> will be reverted= to a proper working runtime value.=0A=0A>=0A> Hope this helps.=0A> Niall= =0A>=0A> ----- Original Message ----=0A> From: Keith Byrne <kabyrne@gmail.c= om>=0A> To: =0As...@li...=0A> Sent: Monday, June = 11, 2007 10:33:16 AM=0A> Subject: [Simple-support] Element/Attribute Defaul= t Values=0A>=0A>=0A> I have a situation where a field isn't required, but w= hen it's null and is=0A=0A> serialized, the tag still needs to show up empt= y. Specifically, there is a=0A> String field (webAddress) that has an Attr= ibute annotation, that went it's=0A> null should be serialized to <webAddre= ss/>, instead of not showing up. Is=0A=0A> there a way to intercept the se= rializing of an Element/Attribute, and based=0A> upon it's type, serialize = a default value?=0A> ------------------------------------------------------= -------------------=0A=0A> This SF.net email is sponsored by DB2 Express=0A= > Download DB2 Express C - the FREE version of DB2 express and take=0A> con= trol of your XML. No limits. Just data. Click to get it now.=0A> =0Ahttp://= sourceforge.net/powerbar/db2/=0A> _________________________________________= ______=0A> Simple-support mailing list=0A> Sim...@li...= .net=0A=0A> https://lists.sourceforge.net/lists/listinfo/simple-support=0A>= =0A>=0A> ------------------------------=0A> Shape Yahoo! in your own image.= Join our Network Research Panel today!<=0Ahttp://us.rd.yahoo.com/evt=3D485= 17/*http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=3D7>=0A> ----= ---------------------------------------------------------------------=0A=0A= > This SF.net email is sponsored by DB2 Express=0A> Download DB2 Express C = - the FREE version of DB2 express and take=0A> control of your XML. No limi= ts. Just data. Click to get it now.=0A> =0Ahttp://sourceforge.net/powerbar/= db2/=0A> _______________________________________________=0A> Simple-support= mailing list=0A> Sim...@li...=0A=0A> https://lists= .sourceforge.net/lists/listinfo/simple-support=0A>=0A>=0A> ----------------= --------------=0A> Got a little couch potato?=0A=0A> Check out fun summer a= ctivities for kids.<http://us.rd.yahoo.com/evt=3D48248/*http://search.yahoo= .com/search?fr=3Doni_on_mail&p=3Dsummer+activities+for+kids&cs=3Dbz=0A>=0A>= =0A>=0A> ------------------------------=0A> Sick sense of humor? Visit Yaho= o! TV's Comedy with an Edge=0A> <=0Ahttp://us.rd.yahoo.com/evt=3D47093/*htt= p://tv.yahoo.com/collections/222>to=0A> see what's on, when.=0A>=0A--------= ------ next part --------------=0AAn HTML attachment was scrubbed...=0A=0A-= -----------------------------=0A=0A=0A-------------------------------------= ------------------------------------=0AThis SF.net email is sponsored by DB= 2 Express=0ADownload DB2 Express C - the FREE version of DB2 express and ta= ke=0Acontrol of your XML. No limits. Just data. Click to get it now.=0A=0Ah= ttp://sourceforge.net/powerbar/db2/=0A=0A------------------------------=0A= =0A_______________________________________________=0ASimple-support mailing= lis...@li...=0Ahttps://lists.sourceforge= .net/lists/listinfo/simple-support=0A=0A=0AEnd of Simple-support Digest, Vo= l 3, Issue 5=0A=0A********************************************=0A=0A=0A=0A-= ------------------------------------------------------------------------=0A= This SF.net email is sponsored by DB2 Express=0ADownload DB2 Express C - th= e FREE version of DB2 express and take=0Acontrol of your XML. No limits. Ju= st data. Click to get it now.=0Ahttp://sourceforge.net/powerbar/db2/=0A____= ___________________________________________=0ASimple-support mailing list= =0AS...@li...=0Ahttps://lists.sourceforge.net/lis= ts/listinfo/simple-support=0A=0A=0A=0A=0A=0A=0A=0A ___________________= _________________________________________________________________=0ALuggage= ? GPS? Comic books? =0ACheck out fitting gifts for grads at Yahoo! Search= =0Ahttp://search.yahoo.com/search?fr=3Doni_on_mail&p=3Dgraduation+gifts&cs= =3Dbz |