Hi Dhruv,

XPath can't be used with JiBX, and to get the kind of selective unmarshalling you're looking for (only look for element names corresponding to mapped classes, processing those and ignoring everything else) you'd need to write a custom unmarshaller. This isn't all that difficult to do, with examples provided in org.jibx.extras. The basic approach this would take would be a loop that finds the next
element start tag, checks if the start tag matches an unmarshalling (by
calling the org.jibx.runtime.impl.UnmarshallingContext.getUnmarshaller()
method), and calls the returned IUnmarshaller if non-null.

If you have other questions please ask them on the jibx-users email
list (copied for this response), where everyone can see the answers. Thanks,

 - Dennis

[EMAIL PROTECTED] wrote:

Hi Dave
  I saw the jibx article on ibm series and it seems cool.  It seems to be right 
on in that it seperates XML mapping from business objects.

I am excited about it and want to use and as such had some questions:
1) Can jibx create multiple object instances from an XML file?

if I have lots of customer elements in one file can I use JIBX to create a list 
of Customer objects from that file?

  2) if the multiple customer elements are nested in a couple levels of 
elements, that are not needed by objects, can they be ignored in jibx and in 
the binding file?

meaning can I naively just map my objects to the elements I care about regardless of how they are structured in the XML.
Example:
Can I just make a binding file for customer elements and pretend the root and 
parent elements do not matter as I don't need them for my objects?  or would I 
have to represent the hierarchy or xpath to the elements of interest for the 
objects?

e.g. xml where only customer elements are needed for objects but they are 
nested in extraneous element layers (A,B,C elements are parents) which should 
be ignored?

3) it would be cool if xpath could be used to map elements to objects.

'<nodes>
  <A>
    <B>
       <C>
        <Customer/>
       </c>
    </B>
       <B>
       <C>
        <Customer/>
       </c>
    </B>
    <B>
       <C>
        <Customer/>
       </c>
    </B>
  </A>'
thanks

Dhruv


-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to