There's a slightly more standard "workaround" to this problem in
org.jibx.extras.DiscardElementMapper (in jibx-extras.jar).  Rewrite your
binding file like this:

<binding direction="input">
  <mapping name="Status" class="Status" ordered="false">
    <value name="Num1" field="myNum1" usage="optional" />
    <value name="Num2" field="myNum2" usage="optional" />

    <structure usage="optional" set-method="setIgnored"
      marshaller="org.jibx.extras.DiscardElementMapper"
      unmarshaller="org.jibx.extras.DiscardElementMapper" />
  </mapping>
</binding>

And add a "setIgnored" method to Status:

  public void setIgnored( String s )
  {
  }

And the second example will unmarshall correctly.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Fer
Sent: Sunday, May 22, 2005 8:26 PM
To: [email protected]
Subject: Re: [jibx-users] Newbie: ignoring XML tags during unmarshalling

I did a little change in 
org.jibx.runtime.impl.UnmarshallingContext.java, in order to verify only

the namespace in all three point where throwEndTagNameError is called. 
Then I just rebuilt the jibx-run.jar and now it's working for me.
Of course, I'm forced to use ordered="false" in the mapping tag, and 
usage="optional" in all the fields, but that is not a problem in my 
case. I know this is not a real solution, since behavior could be 
unexpected when the xml is malformed, but in my particular case I think 
that it will be enough until JiBX 2.0 were released.

Fernando


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_idt12&alloc_id344&op=click
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to