Roy, Andrew
 
can I kindly ask you to move this discussion to 
[email protected] as per my announcement last week ? 
Actually, I have added [email protected] to CC already. 

Regards
Werner

wg> wg> -----Urspr�ngliche Nachricht-----
wg> wg> Von: Andrew Fawcett [mailto:[EMAIL PROTECTED]
wg> wg> Gesendet: Donnerstag, 07. April 2005 17:39
wg> wg> An: [email protected]
wg> wg> Betreff: Re: [castor-user] XML: xsd default values
wg> wg> 
wg> wg> 
wg> wg> Hi Roy,
wg> wg> 
wg> wg> I'll take a look at this if you can mail me your test 
wg> wg> example please.
wg> wg> 
wg> wg> Thanks.
wg> wg> 
wg> wg> -----Original Message-----
wg> wg> From: Roy van der Kuil [mailto:[EMAIL PROTECTED] 
wg> wg> Sent: 06 April 2005 12:04
wg> wg> To: [email protected]
wg> wg> Subject: [castor-user] XML: xsd default values
wg> wg> 
wg> wg> 
wg> wg> Hi All,
wg> wg> 
wg> wg> I seem to have a problem with reading xml with an xsd 
wg> wg> element that has a
wg> wg> default value.
wg> wg> For example given the xsd:
wg> wg> 
wg> wg> <?xml version='1.0' encoding='UTF-8'?>
wg> wg> <xs:schema targetNamespace="http://foo.org/foo";
wg> wg> elementFormDefault="qualified" 
wg> attributeFormDefault="unqualified"
wg> wg> xmlns:foo="http://foo.org/foo";
wg> wg> xmlns:xs="http://www.w3.org/2001/XMLSchema";>
wg> wg>    <xs:element name="FooElement" id="foo">
wg> wg>        <xs:complexType>
wg> wg>            <xs:sequence>
wg> wg>                <xs:element name="FooSub" default="bar">
wg> wg>                    <xs:simpleType>
wg> wg>                        <xs:restriction base="xs:string">
wg> wg>                            <xs:enumeration value="foo" />
wg> wg>                            <xs:enumeration value="bar" />
wg> wg>                        </xs:restriction>
wg> wg>                    </xs:simpleType>
wg> wg>                </xs:element>
wg> wg>            </xs:sequence>
wg> wg>        </xs:complexType>
wg> wg>    </xs:element>
wg> wg> </xs:schema>
wg> wg> 
wg> wg> and the xml:
wg> wg> <FooElement><FooSub/></FooElement>
wg> wg> 
wg> wg> Checking this with xml-spy and jdom (which I beleive uses 
wg> wg> xerces for xsd
wg> wg> validation) gives me that the above xml is valid.
wg> wg> 
wg> wg> However when I run this through castor (I have tested 
wg> this with the
wg> wg> castor -cvs version of april 1st), it fails with "The field 
wg> wg> '_fooSub'
wg> wg> (whose xml name is 'FooSub') is a required field of class
wg> wg> 'foo.FooElement{file: [not available]; line: 1; column: 35}"
wg> wg> 
wg> wg> Now, it can be fairly easy to patch the castor code to 
wg> change the
wg> wg> setFooSub(FooSub fs)  method to fall back the the default 
wg> wg> whenever null
wg> wg> is passed, but I wonder if that is the correct 
wg> behaviour for this.
wg> wg> 
wg> wg> Did anyone else experience this problem?
wg> wg> 
wg> wg> I have a test example here, if anyone is interested I can 
wg> wg> mail it, so
wg> wg> you can test this for yourself.
wg> wg> 
wg> wg> If my patch is the appropriate behaviour (falling back to 
wg> wg> default when
wg> wg> null is passed), than I can mail that patch too, of course.
wg> wg> 
wg> wg> Thanks for your comments/time on this.
wg> wg> 
wg> wg> -Roy van der Kuil
wg> wg> 
wg> wg> 
wg> wg> 
wg> wg> -----------------------------------------------------------
wg> wg> If you wish to unsubscribe from this mailing, send mail to
wg> wg> [EMAIL PROTECTED] with a subject of:
wg> wg>         unsubscribe castor-user
wg> wg> 
wg> wg> 
wg> wg> The information in this message is confidential and may be 
wg> wg> legally privileged. It may not be disclosed to, or used by, 
wg> wg> anyone other than the addressee. If you receive this 
wg> wg> message in error, please advise us immediately.  Internet 
wg> wg> emails are not necessarily secure. CODA does not accept 
wg> wg> responsibility for changes to any email which occur after 
wg> wg> the email has been sent. Attachments to this email may 
wg> wg> contain software viruses, which could damage your systems. 
wg> wg> CODA has checked the attachments for viruses before 
wg> wg> sending, but you should virus-check them before opening.        
wg> wg> 
wg> wg> 
wg> 

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-user

Reply via email to