Hi Geoff,

JiBX doesn't support capturing the entire content of the "paratext" element as a string - the content is XML, and will always be processed as XML. You've basically got two alternatives for doing what you want: Use a document model for the content of the paratext element (DOM and dom4j have marshaller/unmarshallers included in the extras jar); or write your own marshaller/unmarshaller. The latter alternative is not terribly difficult, but would involve some added work to look into the examples (mainly in the org.jibx.extras source tree). That way you could accumulate all the text separately from the embedded elements.

 - Dennis

[EMAIL PROTECTED] wrote:

Would anyone have a suggestion as to how I could model the following XML:
    <paratext>
        Line One.
        <footnote.reference refid="1" />
        Line Two.
        <footnote.reference refid="2" />
        Line Three.
    </paratext>
Ideally I would like to capture the entire content of the "paratext" element as a string.
Then bind each "footnote.reference" element into a collection.
I've tried the following binding definition (simplified version):
    <mapping name="paratext" class="model.ParaText" ordered="true">
<value field="text" set-method="setText" usage="optional" style="text" />
        <collection field="footnoteEntries" usage="optional"
            item-type="model.FootnoteReference" />
    </mapping>
<mapping name="footnote.reference" class="model.FootnoteReference" ordered="false"> <value style="attribute" name="refid" field="refId" usage="optional"/>
    </mapping>
But with this binding, I'm able to collect the footnote entries, but only able to capture as a string the first line ("Line One."). Any thoughts on how to go about this?
Would this require a custom unmarshaller?
- Geoff



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to