Re: [Simple-support] Problem with using Element List
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2007-09-16 11:28:41
|
Hi, Yes, if you want to add this at the beginning, you can do this. String text = "<?xml version=\"1.0\"?>" + "<!DOCTYPE database SYSTEM \"http://db.apache.org/torque/dtd/database.dtd\">"; Format format = new Format(text); Persister persister = new Persister(format); The heading will then appear at the start of the generated XML document. Niall --- Wessam Abd Rabo <wes...@gm...> wrote: > Thanks, it worked. I have another question. Is there > a way to generate the > following 2 lines at the beginning of XML file? > <?xml version="1.0"?> > <!DOCTYPE database SYSTEM > "http://db.apache.org/torque/dtd/database.dtd"> > > Thanks again > > Wessam > > > On 9/14/07, Wessam Abd Rabo > <wes...@gm...> wrote: > > > > Hi, > > Am experiencing a problem on trying to use > ElementList inside my code. Am > > trying to produce XML in the following format: > > > > <database name="Company"> > > > > <table name="Employee"> > > <column name="ssn" primary key="true"/> > > <column name="sname" /> > > </table> > > > > <table name="Department"> > > <column name="dcode" primary key="true"/> > > <column name="dname" /> > > </table> > > > > </database> > > > > > > However the one produced looks as follows: > > > > <database name="Company"> > > <table> > > > > <table name="Employee"> > > <column> > > <column name="ssn" primary key="true"/> > > <column name="sname" /> > > </column> > > </table> > > > > <table name="Department"> > > <column> > > <column name="dcode" primary key="true"/> > > <column name="dname" /> > > </column> > > </table> > > > > </table> > > </database> > > > > I think i have a problem with using ElementList. > In my code, i > > declare class database in which i declare the > following Arraylist to get the > > tables list: > > > > @ElementList(name="table") > > ArrayList <table> list; > > > > Class Table looks as follows: > > > > @Root(name="table") > > > > class table{ > > > > @Attribute(name="name") > > private String name; > > > > @ElementList(name="Column") > > private ArrayList<Entry> list; > > > > ......} > > > > I declare inside table another arraylist for the > columns. Class Column: > > > > > > @Root(name="column") > > public class column { > > > > @Attribute(name="name") > > private String name; > > > > @Attribute(name="primary key") > > private boolean value; > > ........} > > > > i'm not sure if the format i want can still be > generated if i use > > elementlist in the same way. > > > > i need help with this > > > > Thanks in advance > > > > Wessam > > > > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio > 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/> _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support > ____________________________________________________________________________________ Yahoo! oneSearch: Finally, mobile search that gives answers, not web links. http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC |