Hi Mishra, Check if adding name="field" to the collection tag will solve the problem? So <collection name="field" field="questions" ... >
Regards, Frank. > > Hi guys. > I am new to jibx ( starting using yesterday ) and i am stuck now. Can > someone please help me out here. > > Here is the sample xml i am working with: > > <questionnaire ....> > <field> > <question id="1"> > How old are you ? > </question> > </field> > > <field> > <question id="2" > > <question> Whats your name ? </question> > </field> > ...... more field elements followed by question element > </questionnaire> > > There are multiple <field> elements which has <question> element. > > I have a Questionnaire Obeject which has a collection of QUestions > (ArrayList). > How to i write the mappings so that the <field> element is not mapped. At > the moment JIBX complains when it finds multiple <field> elements. > > I dont care about <field> i just want the list of questions and store it > on > questionnaire object. > > This is what i have at the moment: > > <mapping name="questionnaire" > class="com.brainresouce.questionnaire.QuestionnaireImpl" > > > > <collection field="questions" > item-type="com.brainresouce.question.QuestionImpl" /> > > </mapping> > > <mapping name="question" class="com.brainresouce.question.QuestionImpl"> > ... > </mapping> > > I tried using flexible="true" but then the JIBX compiler complains that i > cant use that ..... > > Java stacktrace: > Throwable > org.jibx.runtime.JiBXException: Expected "questionnaire" end tag, found > "field" start tag (line 26, col 10) > at > org.jibx.runtime.impl.UnmarshallingContext.parsePastCurrentEndTag(UnmarshallingContext.java:792) > at > com.brainresouce.questionnaire.JiBX_NewQuestionnaire_bindingQuestionnaireImpl_access1.unmarshal() > at > org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2537) > at > org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2680) > at > com.brainresouce.questionnaire.repository.QuestionnaireRepositoryImpl.loadFromFile(QuestionnaireRepositoryImpl.java:64) > at > com.brainresouce.questionnaire.repository.QuestionnaireRepositoryImpl.loadQuestionnaire(QuestionnaireRepositoryImpl.java:41) > at > com.brainresource.test.QuestionnaireRepositoryImplTest.testQuestionnaireLoad(QuestionnaireRepositoryImplTest.java:49) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > > > > > > -- > View this message in context: > http://www.nabble.com/Need-help-with-complex-JIB-X-mapping-tf4874338.html#a13947189 > Sent from the jibx-users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------- > 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/ > _______________________________________________ > jibx-users mailing list > jibx-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jibx-users > ------------------------------------------------------------------------- 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/ _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users