Guillaume Pothier wrote:

Looking at the JiBX source code, it seems that non-global id support is pretty advanced, does it need anything more than testing?

A number of the hooks are in place, but I've never tried it out. You're welcome to try it and see how far it gets (global-ids="false" on the <binding>). I may even provide some support if the fixes are easy...

However, I think that type-based id spaces might not work for every situation: there can be cases where elements that are bound to distinct classes have to share the same id space, and conversely elements of the same class could need to be in two distinct id spaces.
I think more situations could be handled by a scheme like this: instead of ident="ref" and ident="def", using attributes like key="keyid" and keyref="keyid", like in xsd shemas. This would let the user define its id spaces.


The schema key/keyref idea gets into XPath constructions, which I don't think will fit well with JiBX. If you want to look into this and suggest a way they could be worked into the existing framework I'll certainly consider it, though.


There is another use case of IDs that I have not been able to handle with JiBX. Consider the following file:


<functions>
    <function id="1">
        (...)
        <related-functions>
            <function-ref functionId="2"/>
        </related-functions>
    </function>
    <function id="2">
        (...)
        <related-functions/>
    </function>
</functions>

In each function element I have a collection of related functions. In my java classes, the collection contains instances of Function directly. In other words, each <function-ref> tag is unmarshalled to the Function object that corresponds to its id, not to a FunctionRef object that has a Function field. Is it possible to do that with JiBX? Right now I am doing it with a custom marshaller/unmarshaller.
Guillaume


You *should* be able to do this:

 <collection name="related-functions" ...>
   <structure name="function-ref">
     <value style="attribute" name="functionId" ident="ref"/>
   </structure>
 </collection>

This is getting into the edge cases where the current code generation may have problems (especially since the value is actually a reference), so it may not work. If it doesn't, please enter a bug report in Jira.

- Dennis



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to