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