Ah well, I was typing from memory... Glad that fixed it!

 - Dennis

Bower.Eric wrote:

That did it, thanks!  Only it's not the isAt() method, but isPresent() that I 
had wrong.

Thanks again,
 Eric

-----Original Message----- From: Dennis Sosnoski [mailto:[EMAIL PROTECTED] Sent: Thu 12/22/2005 12:11 PM To: [email protected] Cc: Subject: Re: [jibx-users] Optional usage problem with custom unmarshaller
        
        

        Hi Eric,
        
        Is your unmarshaller implementing the isAt() method properly, checking
        if the current start tag is the element name defined for the
        unmarshaller? That's the first place I'd look. Also, I assume you
        implemented the form of unmarshaller that allows for name substitution
        in the binding (as opposed to hardcoding the "cal" name), right?
        
          - Dennis
        
        Bower.Eric wrote:
        
        >I am experiencing a problem when unmarshalling a document with an 
optional field that is handled using a custom unmarshaller.  The custom code is 
unmarshalling a Calendar object.  I have looked at using a Deserializer, but need 
to write out the time in millis and a formatted string (used in xslt).  JiBX has 
no problems when the field is not present, but when it is found in the xml I am 
getting the following exception:
        >
        >Exception in thread "main" org.jibx.runtime.JiBXException: Expected "values" end 
tag, found "optionalCal" start tag
        >
        >My unmarshaller isn't doing anything special, it only uses the millis 
attribute to set a Calendar object, and I am not having any problems when 
marshalling the document whether the field is null or not.
        >
        >My bind file is:
        ><binding>
        >  <mapping name="root" class="TestRoot">
        >    <collection factory="org.jibx.runtime.Utility.arrayListFactory" field="values" 
item-type="OptionalField"/>
        >  </mapping>
        >  <mapping name="values" class="OptionalField">
        >    <structure name="cal" field="cal"
        >                    marshaller="CalendarMapper" 
unmarshaller="CalendarMapper"/>
        >    <structure name="optionalCal" usage="optional" field="optionalCal"
        >                    marshaller="CalendarMapper" 
unmarshaller="CalendarMapper"/>
        >  </mapping>
        >  <mapping class="java.util.Calendar" marshaller="CalendarMapper" 
unmarshaller=CalendarMapper" />
        ></binding>
        >
        >
        >My input xml file is:
        ><root>
        >  <values>
        >    <cal millis="1128021806000">09/29/2005 15:23:26</cal>
        >  </values>
        >  <values>
        >    <cal millis="1128021806000">09/29/2005 15:23:26</cal>
        >    <optionalCal millis="1128021806000">09/29/2005 
15:23:26</optionalCal>
        >  </values>
        ></root>
        >
        >
        >I have tried both the RC1 and RC2 releases but found the same result 
each time.  Any suggestions would be much appreciated.
        >
        >
        >Thanks,
        >  Eric
        >
        >The information contained in this email message is intended only for 
the use of the individuals to whom it is addressed and may contain information 
that is privileged and sensitive. If the reader of this message is not the 
intended recipient, you are hereby notified that any dissemination, distribution 
or copying of this communication is strictly prohibited. If you have received this 
communication in error, please notify the sender immediately by email at the above 
referenced address. Thank 
you.�����������������������������������������ӆ+�޵隊X���'���u��J�n�B's��ʋ���m��.�h��z�讚�nW���ã
        [EMAIL PROTECTED],��� a{��3�4��
        
>#�P����i���v����r������~�jYhs�����������������������������������������o��왨��x%��c����ǫ��b������q�����a��l����l��.�ǟ���w��X�����b��?�&���
        >
> > NHu~z^zzjɺ{ ,H4i
N�HY޵隊X���'���u���[�������
ަ�k��!���W�~�鮆�zk��C� [EMAIL PROTECTED],����a{���,�H��4�m���i�(��ܢo�v'

Reply via email to