If you upgrade to jibx >= 1.1, you can declare the containing structure "ordered='false' flexible='true'" and accomplish the same effect. You do still have to explicitly declare this on each structure declaration, though.
On Thu, 2008-01-17 at 08:39 -0600, [EMAIL PROTECTED] wrote: > Is it possible in JIBX to have a mapping which tells it to ignore any other > XML elements in this structure. Say in the below example if say the system > now starts to add another element to the XML > > <element1.4>text1.4</element1.4> > > but we really donot care and would ignore it, then is there any way to set > it to ignore WITHOUT changing the binding file and binding classes. Is it > possible to define somewhere in the structure which says like "Donot throw > an error if you donot match the exact sequence, but go to the next tag > which is matches the element in the binding file " > > Below would acomplish something of that , but we would then have to add it > to EVERY structure we have . basically something like turn OFF the schema > validation > > <structure usage="optional" get-method="getIgnored" set-method="setIgnored" > marshaller="org.jibx.extras.DiscardElementMapper" > unmarshaller="org.jibx.extras.DiscardElementMapper" /> > > Gary > > > > > > Dennis Sosnoski > <[EMAIL PROTECTED] > > To > Sent by: JiBX users > jibx-users-bounce <jibx-users@lists.sourceforge.net> > [EMAIL PROTECTED] cc > ge.net > Subject > Re: [jibx-users] Extrem flattened > 01/16/2008 11:59 binding > PM > > > Please respond to > JiBX users > <[EMAIL PROTECTED] > .sourceforge.net> > > > > > > > Hi Wolle, > > I think the problem here is that you didn't specify any handling for the > <sub1.1> element, so when JiBX sees this element while unmarshalling it > assumes it's past the elements which were named in the binding - and > since it hasn't seen a <sub1.2> yet it complains about that being > missing. You should be able to just add a <structure name="sub1.1" > usage="optional"/> to your binding (as another child of the <structure > name="sub1" ordered="false"> element) to tell JiBX to discard the sub1.1 > element if it sees one. > > - Dennis > > Dennis M. Sosnoski > SOA and Web Services in Java > Training and Consulting > http://www.sosnoski.com - http://www.sosnoski.co.nz > Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117 > > > > Wolf-Dieter Mische wrote: > > Hello again, > > > > after my compiling problem is solved I have another one. > > > > I had following xml structure: > > <root> > > <sub1> > > <sub1.1> > > <element1.1>text1.1</element1.1> > > <element1.2>text1.2</element1.2> > > <element1.3>text1.3</element1.3> > > </sub1.1> > > <sub1.2> > > <element2>text2</element2> > > </sub1.2> > > <sub1.3> > > <element3>text3</element3> > > </sub1.3> > > </sub1> > > </root> > > No how have the binding file to, if I just want to unmarshall it into one > class like this: > > public class root { > > public String element2; > > public String element3; > > } > > > > I tried it with following binding.xml, but receiving this exception: > > org.jibx.runtime.JiBXException: Missing required element "sub1.2" > > > > <binding> > > <mapping name="root" class="org.domain.Root" ordered="false"> > > <structure name="sub1" ordered="false"> > > <structure name="sub1.2" ordered="false"> > > <value name="element2" field="element2"/> > > </structure> > > <structure name="sub1.3" ordered="false"> > > <value name="element3" field="element3"/> > > </structure> > > </structure> > > </mapping> > > </binding> > > > > Is it possible to map such a structure? > > > > > > King regards > > Wolle > > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > 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 > > > Generally, this communication is for informational purposes only > and it is not intended as an offer or solicitation for the purchase > or sale of any financial instrument or as an official confirmation > of any transaction. In the event you are receiving the offering > materials attached below related to your interest in hedge funds or > private equity, this communication may be intended as an offer or > solicitation for the purchase or sale of such fund(s). All market > prices, data and other information are not warranted as to > completeness or accuracy and are subject to change without notice. > Any comments or statements made herein do not necessarily reflect > those of JPMorgan Chase & Co., its subsidiaries and affiliates. > > This transmission may contain information that is privileged, > confidential, legally privileged, and/or exempt from disclosure > under applicable law. If you are not the intended recipient, you > are hereby notified that any disclosure, copying, distribution, or > use of the information contained herein (including any reliance > thereon) is STRICTLY PROHIBITED. Although this transmission and any > attachments are believed to be free of any virus or other defect > that might affect any computer system into which it is received and > opened, it is the responsibility of the recipient to ensure that it > is virus free and no responsibility is accepted by JPMorgan Chase & > Co., its subsidiaries and affiliates, as applicable, for any loss > or damage arising in any way from its use. If you received this > transmission in error, please immediately contact the sender and > destroy the material in its entirety, whether in electronic or hard > copy format. Thank you. > Please refer to http://www.jpmorgan.com/pages/disclosures for > disclosures relating to UK legal entities. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > 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 2008. 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