Hi Jay,

To ignore the <TxnInfo> element just use <structure name="TxnInfo"/> at the appropriate place in your binding definition. This will skip the <TxnInfo> element when unmarshalling, and write an empty one when marshalling. If you want to skip writing it on marshalling, use usage="optional"

 - Dennis

Jay Blanton wrote:

Sorry...I figured it out with the abstract="true".

Not sure if I can piggy back of this question though.

Below I have a TxnInfo segment that I do not represent in my object model. Is there a way I can ignore this element in the marshal/unmarshal?

Because I get a org.jibx.runtime.JiBXException: No unmarshaller for element "TxnInfo" (line 3, col 11) since I have not defined a mapping for it.

Thanks,

-jay


On 4/13/06, *Jay Blanton* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    If I have portions of my object model that do not exist in the
    incoming XML, how do I bypass placing a name attribute on the
    mapping definition.

    For instance, I have the following XML chunk:

    <AppBody>
        <TxnInfo>
            <SystemId>WebService</SystemId>
        </TxnInfo>
        <Sponsor>
            <Id>0013</Id>
        </Sponsor>
        <Person>
            <Id>123</Id>
        </Person>
    </AppBody>

    The AppBody is the beginning of my ResponseTO which contains an
    ErrorInfo object (if the xml exists) and a list (custom
    collection) of FamilyTOs.  The FamilyTO contains an object called
    SponsorTO and PersonTO.  So as you can see, there is no Family
    element in the XML...it is just a composite object that holds the
    SponsorTO and PersonTO.  How do I define my mapping segment below
    so that I can use the FamilyTO mapping without having to include
    an element name?

        <mapping name="AppBody" class="com.foo.to.ResponseTO">
            <collection field="families" load-method="get"
    size-method="size" add-method="add" item-type="
    com.foo.to.FamilyTO" usage="optional"/>
<structure field="errorInfo" usage="optional"/> </mapping>
        <mapping name="ErrorInfo" class=" com.foo.to.ErrorInfoTO">
            <value name="ErrorType" field="errorType" usage="optional"/>
            <value name="ErrorMsgUser" field="userMessage"
    usage="optional"/>
            <value name="ErrorMsgTechnical" field="technicalMessage"
    usage="optional"/>
            <value name="ErrorCode" field="errorCode" usage="optional"/>
        </mapping>
        <mapping class="com.foo.to.FamilyTO">
            <structure field="sponsor" usage="optional"/>
            <collection field="patients" load-method="get"
    size-method="size" add-method="add" item-type="
    com.foo.to.PatientTO" usage="optional"/>
            <structure field="sponsor" usage="optional"/>
        </mapping>

    Thanks!

-- jay blanton
    [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>




--
jay blanton
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
(c) 916-715-1529



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to