I have written a TreeSetMapper. If some one could review it will help me to move forward.
I am still stuck with Basically I have a object which has HashMap of dbColumns and HAshMap of tableProperties. My binding.xml is as follows. The data.xml is also attached. When I try to run the TestRoundTrip I get the following error runbindings: [jar] Building jar: C:\jibx\lib\runtimebindings.jar runTest16: [java] org.jibx.runtime.JiBXException: Expected start tag, found end tag "e ntry" (line 14, col 48) [java] at org.jibx.runtime.impl.UnmarshallingContext.toStart(Unmarshall ingContext.java:489) [java] at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(U nmarshallingContext.java:2561) [java] at org.jibx.custombindings.HashMapper.unmarshal(HashMapper.java: 157) [java] at example16.DBTable.JiBX_jibx_tutorial_example16_binding_unmars hal_1_0(DBTable.java) [java] at example16.JiBX_jibx_tutorial_example16_bindingDBTable_access. unmarshal() [java] at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(U nmarshallingContext.java:2568) [java] at org.jibx.custombindings.HashMapper.unmarshal(HashMapper.java: 157) [java] at example16.DBModel.JiBX_jibx_tutorial_example16_binding_unmars hal_1_0(DBModel.java) [java] at example16.JiBX_jibx_tutorial_example16_bindingDBModel_access. unmarshal() [java] at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(U nmarshallingContext.java:2568) [java] at org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument( UnmarshallingContext.java:2736) [java] at org.jibx.extras.TestRoundtrip.runTest(TestRoundtrip.java:86) [java] at org.jibx.extras.TestRoundtrip.main(TestRoundtrip.java:140) [java] Error round-tripping class: example16.DBModel [java] with input file example16/data.xml and output compared to example16 /data.xml [java] Saved output document file path C:\jibx\tutorial\temp.xml BUILD FAILED file:C:/jibx/tutorial/build.xml:346: Java returned: 1 Any inputs or suggestions ? Thanks in Advance Sudhi -----Original Message----- From: Dennis Sosnoski [mailto:[EMAIL PROTECTED] Sent: Monday, May 03, 2004 10:05 AM To: Sudhendra Seshachala Cc: Dennis Sosnoski; [EMAIL PROTECTED] Subject: Re: [jibx-users] Question of Compile time bindings and runtimebindigs Yes, looking at your binding I see why this comes up - the first <mapping> is for java.util.HashMap, which is a package that we can't use directly. As it says in the documentation for the <binding> element package attribute: "package - Java package used for created binding factory class. By default this is the same package as the class associated with the first mapping child element. If present, the value must be a Java package name (as in "org.jibx.runtime")." We can't add stuff to the "java.util" package, so instead it winds up in the default package. If you reordered your <mapping> elements the classes would instead go into the package you're expecting automatically. The file name conversion to a binding name is working as currently documented, but for beta 4 I think I'll change this to instead use only the base file name (with leading directory path information stripped off). This would make the added file names "JiBX_StcdbDatabaseModel_bindingFactory" rather than "JiBX_hawaii_stcdbeway_repository_src_java_com_stc_stcdbeway_repository_impl_StcdbDatabaseModel_bindingFactory", for instance, which seems more reasonable (especially since the same name string will be used for methods added to your classes). - Dennis Sudhendra Seshachala wrote: >I think I got it. Pretty simple one. >It was just another ant task issue. Basically I have to give fully qualified package >namw where the files will be generated. > >Thanks >Sudhi > >-----Original Message----- >From: Dennis Sosnoski [mailto:[EMAIL PROTECTED] >Sent: Friday, April 30, 2004 6:45 PM >To: Sudhendra Seshachala >Subject: Re: [jibx-users] Question of Compile time bindings and runtimebindigs > > >No, these should be automatic. If you can send me your binding >definition file, the actual command you're using to run the binding >compiler, and a zip file of the classes in your package after running >the binding compiler I'll try to track down what's going wrong. Normally >the name of your binding factory class is not going to be such a long >string, so I think something strange is happening. > >- Dennis > >Sudhendra Seshachala wrote: > > > >>Do I need to set any property before compiling bindings to generate >>*bindingFactory.class and *MungeAdapter.class ? >> >>Thanks >>Sudhi >> >>-----Original Message----- >>From: Sudhendra Seshachala >>Sent: Friday, April 30, 2004 4:21 PM >>To: 'Dennis Sosnoski' >>Subject: RE: [jibx-users] Question of Compile time bindings and runtimebindigs >> >>When I investigated the jar file and also compilation the following >>file is not getting generated >>"JiBX_hawaii_stcdbeway_repository_src_java_com_stc_stcdbeway_repository_impl_StcdbDatabaseModel_bindingFactory" >>I believe this is what is causing the issue >> >> >>-----Original Message----- >>From: Dennis Sosnoski [mailto:[EMAIL PROTECTED] >>Sent: Friday, April 30, 2004 4:14 PM >>To: Sudhendra Seshachala >>Cc: [EMAIL PROTECTED] >>Subject: Re: [jibx-users] Question of Compile time bindings and runtimebindigs >> >>Oh, I'm sorry - I thought (partially from the subject line) that you >>were using the runtime binding support. After reading it through again I >>see that's not the case at all. >> >>I don't know what *is* happening in this case, unless you've actually >>got two sets of your class files in the class path and you're picking up >>the wrong set (the ones that haven't had the binding compiler run on >>them). That seems the most likely cause, if you're sure the JiBX files >>are included in the jar file. Please double-check this issue. >> >>If you can't find a problem with the classpath, send me (directly) the >>jar file and I'll try it here. >> >>- Dennis >> >>Sudhendra Seshachala wrote: >> >> >> >> >> >>>I did follow the following steps >>>I compile my java classes >>> >>> >>> >>> >>> >>> >>>>>Run JiBX binding compiler >>>>> >>>>>Jar all the classes including the generated files. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>-----Original Message----- >>>From: Dennis Sosnoski [mailto:[EMAIL PROTECTED] >>>Sent: Friday, April 30, 2004 3:36 PM >>>To: Sudhendra Seshachala >>>Cc: [EMAIL PROTECTED] >>>Subject: Re: [jibx-users] Question of Compile time bindings and >>>runtimebindigs >>> >>>The workaround is to do the binding at build time, before the class >>>files are converted into a jar. This is the recommended way of doing >>>things anyway, since it avoids the overhead of processing the binding >>>definition every time you start up your program. The runtime binding is >>>really intended more for debugging than anything else. >>> >>>I just checked Jira and didn't have any problem. You do need to >>>register >>> >>>before you can add an issue, though. >>> >>>- Dennis >>> >>>Sudhendra Seshachala wrote: >>> >>> >>> >>> >>> >>> >>> >>>>Is there a workaround to resolve this ? >>>>We have started using this rocking framework and now we ran into this >>>>issue. >>>>Let me know if I can be of any help in implementing this stuff. >>>> >>>>PS I could not open a issue on jira. Its kind of down I think ? >>>> >>>>Thanks >>>>Sudhi >>>> >>>>-----Original Message----- >>>>From: Dennis Sosnoski [mailto:[EMAIL PROTECTED] >>>>Sent: Friday, April 30, 2004 2:53 PM >>>>To: Sudhendra Seshachala >>>>Cc: [EMAIL PROTECTED] >>>>Subject: Re: [jibx-users] Question of Compile time bindings and >>>>runtimebindigs >>>> >>>> >>>> >>>> >>>> >>>>From the description of the runtime binding at >>> >>> >>> >>> >>>>http://jibx.sourceforge.net/bindonload.html: "At present, runtime >>>>binding only works with classes that are present in the classpath as >>>>individual class files (not in jars)." This really should not be a >>>>requirement for the runtime binding, but works that way because the >>>>build-time binding compiler came first and the runtime binding was >>>> >>>> >>>> >>>> >>>> >>>> >>>built >>> >>> >>> >>> >>> >>> >>>>on top of it. It is something I'd like to change for the future, and >>>>if >>>> >>>> >>>> >>>> >>>> >>>> >>> >>> >>> >>> >>>>you want to enter it as an issue in the Jira system I'll try to get >>>> >>>> >>>> >>>> >>>> >>>> >>>this >>> >>> >>> >>> >>> >>> >>>>fixed for beta 4. >>>> >>>>- Dennis >>>> >>>>Sudhendra Seshachala wrote: >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>>>I have been working on jibx for past 4- 5 days in basically to use >>>>>jibx framework our marshalling and unmarshalling of XML-java objects >>>>> >>>>>Since we are already ahead in development, I am just defining >>>>>binding.xml for our java objects and we have test xml files through >>>>>which we are able to test Roundtripping. >>>>> >>>>>This is fine when we have all java class files "not" part of jar. >>>>> >>>>>The way I do is as follows >>>>> >>>>>I compile my java classes >>>>> >>>>>Run JiBX binding compiler >>>>> >>>>>Jar all the classes including the generated files. >>>>> >>>>>During runtime when I try testing with org.jibx.extras.TestRoundtrip >>>>>I ... >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>------------------------------------------------------- >>>This SF.Net email is sponsored by: Oracle 10g >>>Get certified on the hottest thing ever to hit the market... Oracle >>>10g. >>>Take an Oracle 10g class now, and we'll give you the exam FREE. >>>http://ads.osdn.com/?ad_id149&alloc_id66&opĚk >>>_______________________________________________ >>>jibx-users mailing list >>>[EMAIL PROTECTED] >>>https://lists.sourceforge.net/lists/listinfo/jibx-users >>> >>> >>> >>> >>> >>> >>> >> >> >> >> > > > -- Dennis M. Sosnoski Enterprise Java, XML, and Web Services Training and Consulting http://www.sosnoski.com Redmond, WA 425.885.7197
TreeSetMapper.java
Description: TreeSetMapper.java
<!-- This document acts as bindings document for marshalling and unmarshalling StcdbDatabaseModel @version :$Revision: $ @author Sudhi Seshachala --> <binding> <mapping class="java.util.HashMap" name="map" marshaller="org.jibx.custombindings.HashMapper" unmarshaller="org.jibx.custombindings.HashMapper"/> <mapping name="stcdbDatabaseModel" class="com.stc.stcdbeway.repository.impl.StcdbDatabaseModelImpl"> <value style="attribute" name="name" field="name"/> <value style="attribute" name="description" field="description"/> <!-- sourceOtd is of type RepositoryObject How do we store this ? We could store as refid, whenever we want repository, we might get the active repository and get the relevant repositoryobject. But I am not really sure about this one --> <!-- <value style="attribute" name="sourceOtd" field="sourceOtd"/> --> <!-- <structure field="tables" name= "map" marshaller="org.jibx.custombindings.HashMapper" unmarshaller="org.jibx.custombindings.HashMapper"/> --> <structure field="tables" /> </mapping> <mapping name="stcdbTable" class="com.stc.stcdbeway.repository.impl.StcdbDBTableImpl"> <value style="attribute" name="name" field="name"/> <value style="attribute" name="javaName" field="javaName"/> <!-- We need to handle this <value style="attribute" name="parent" field="parent"/> --> <structure field="columns" /> <!-- <structure field="columns" name= "map" item-type="com.stc.stcdbeway.repository.impl.StcdbDBColumnImpl" marshaller="org.jibx.custombindings.HashMapper" unmarshaller="org.jibx.custombindings.HashMapper"/> <structure field="tableProperties" name="map" item-type="java.lang.String" marshaller="org.jibx.custombindings.HashMapper" unmarshaller="org.jibx.custombindings.HashMapper"/> --> </mapping> <mapping name="stcdbColumn" class="com.stc.stcdbeway.repository.impl.StcdbDBColumnImpl"> <value style="attribute" name="name" field="name"/> <value style="attribute" name="type" field="jdbcType"/> <value style="attribute" name="scale" field="scale"/> <value style="attribute" name="precision" field="precision"/> <value style="attribute" name="cardinalPosition" field="cardinalPosition"/> <value style="attribute" name="isPrimaryKey" field="pkFlag"/> <value style="attribute" name="isForeignKey" field="fkFlag"/> <value style="attribute" name="indexed" field="indexed"/> <value style="attribute" name="nullable" field="nullable"/> <!--<structure field="columnProperties" name="map" item-type="java.lang.String" marshaller="org.jibx.custombindings.HashMapper" unmarshaller="org.jibx.custombindings.HashMapper"/> --> </mapping> </binding>
<stcdbDatabaseModel name="fdff" description="source"> <map size="2"> <entry key="TEST1_CSV"> <stcdbTable name="TEST1_CSV" javaName="Test1Csv"> <map size="2"> <entry key="NAME"> <stcdbColumn name="NAME" type="12" scale="0" precision="25" cardinalPosition="2" isPrimaryKey="false" isForeignKey="false" indexed="false" nullable="true" /> </entry> <entry key="ID"> <stcdbColumn name="ID" type="12" scale="0" precision="4" cardinalPosition="1" isPrimaryKey="false" isForeignKey="false" indexed="false" nullable="true" /> </entry> </map> <attr name="RecordDelimiter" type="java.lang.String" value="slashn"/> <attr name="FieldCount" type="java.lang.String" value="5"/> </stcdbTable> </entry> <entry key="TEST2_CSV"> <stcdbTable name="TEST2_CSV" javaName="Test2Csv"> <map size="2"> <entry key="NAME"> <stcdbColumn name="NAME" type="12" scale="0" precision="25" cardinalPosition="2" isPrimaryKey="false" isForeignKey="false" indexed="false" nullable="true" /> </entry> <entry key="ID"> <stcdbColumn name="ID" type="12" scale="0" precision="4" cardinalPosition="1" isPrimaryKey="false" isForeignKey="false" indexed="false" nullable="true" /> </entry> </map> </stcdbTable> </entry> </map> </stcdbDatabaseModel>