Hello, Thank you Archie for the insight on "flexible".
I was able to work around my issue, thanks to a few previous messages on the list. However, this works because I am only reading RSS format, never writing it (which may need another binding). Here is what works for me: <binding name="binding" package="my.jibx.rss" direction="input"> <mapping name="rss" class="my.jibx.rss.Feed"> <structure name="channel" field="channel" type="my.jibx.rss.Channel" ordered="false" flexible="true" allow-repeats="true"> <value style="element" name="link" field="link" usage="optional" /> <value style="element" name="title" field="title" usage="optional" /> <value style="element" name="description" field="description" usage="optional" /> <structure name="item" type="my.jibx.rss.Item" set-method="addItem" ordered="false" flexible="true"> <value style="element" name="title" field="title" usage="optional" /> <value style="element" name="description" field="description" usage="optional" /> <structure name="image" field="image" type="my.jibx.rss.Image" usage="optional" ordered="false" flexible="true"> <value style="element" name="url" field="url" /> </structure> <structure name="enclosure" field="enclosure" type="my.jibx.rss.Enclosure" usage="optional" ordered="false" flexible="true"> <value style="attribute" name="url" field="url" /> <value style="attribute" name="type" field="type" usage="optional" /> <value style="attribute" name="length" field="length" usage="optional" /> </structure> </structure> </structure> </mapping> </binding> The addItem(Item) method of the Channel class adds the given item to the List<Item> each time an Item is unmarshalled. Best, Bob 2010/10/19 Archie Cobbs <> > > Ironically, things get very inflexible when you specify flexible="true". Here > are some other issues I've found: > > JIBX-402: JiBX fails when abstract type is used with flexible="true" > JIBX-397: Allow setting flexible="true" and ordered="false" at the same time > > I don't really understand why though. It seems like there should be a flag in > the code somewhere that says whether to reject or ignore unknown tags, and > why simply changing that flag causes all these other problems. > > -Archie > > On Tue, Oct 19, 2010 at 7:53 AM, Bob Smith <> wrote: >> >> Hello, >> >> I have been using JiBX for a couple months on basic XML files and I am >> really pleased especially by the performance. >> >> I am now trying to bind an RSS format. >> My issue is that, in RSS, the list of items is not embedded in an <items> >> tag. >> Example: >> <rss> >> <channel> >> <item /> >> <item /> >> <item /> >> </channel> >> </rss> >> >> My binding is as follows: >> <?xml version="1.0" encoding="UTF-8"?> >> <binding name="binding" package="my.jibx.rss"> >> <mapping name="rss" class="my.jibx.rss.Feed"> >> <structure name="channel" field="channel" map-as="channel" /> >> </mapping> >> <mapping abstract="true" type-name="channel" class="my.jibx.rss.Channel" >> ordered="false" flexible="true"> >> <value style="element" name="link" field="link" usage="optional" /> >> <value style="element" name="title" field="title" usage="optional" /> >> <value style="element" name="description" field="description" >> usage="optional" /> >> <collection field="items" create-type="java.util.ArrayList" >> ordered="false" /> >> </mapping> >> <mapping name="item" class="my.jibx.rss.Item" ordered="false" >> flexible="true"> >> <value style="element" name="title" field="title" usage="optional" /> >> <value style="element" name="description" field="description" >> usage="optional" /> >> <structure name="image" field="image" type="my.jibx.rss.Image" >> usage="optional" ordered="false"> >> <value style="element" name="url" field="url" /> >> </structure> >> <structure name="enclosure" field="enclosure" >> type="my.jibx.rss.Enclosure" usage="optional" ordered="false"> >> <value style="attribute" name="url" field="url" /> >> <value style="attribute" name="type" field="type" usage="optional" /> >> <value style="attribute" name="length" field="length" usage="optional" >> /> >> </structure> >> </mapping> >> </binding> >> >> >> Since I do not want to handle some elements that are unnecessary to me and >> that others apps may add with their own namespace, I try to use >> flexible="true" on the Channel mapping. >> However, I cannot use flexible="true" on the Channel mapping because the >> collection of items has no name. Error: >> >> Error: All child components must define element names for flexible='true'; >> on collection element at (line 10, col 83, in rss-binding.xml) >> >> >> And I cannot use a name since there is no eclosing tag in RSS. >> How can this type of collection be handled using JiBX? >> >> Thank you for your help. >> Bob >> >> >> >> >> >> ------------------------------------------------------------------------------ >> Download new Adobe(R) Flash(R) Builder(TM) 4 >> The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly >> Flex(R) Builder(TM)) enable the development of rich applications that run >> across multiple browsers and platforms. Download your free trials today! >> http://p.sf.net/sfu/adobe-dev2dev >> _______________________________________________ >> jibx-users mailing list >> jibx-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/jibx-users > > > > -- > Archie L. Cobbs > > > ------------------------------------------------------------------------------ > Download new Adobe(R) Flash(R) Builder(TM) 4 > The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly > Flex(R) Builder(TM)) enable the development of rich applications that run > across multiple browsers and platforms. Download your free trials today! > http://p.sf.net/sfu/adobe-dev2dev > _______________________________________________ > jibx-users mailing list > jibx-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jibx-users > ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users