I wrote:
> In summary, I have an XML schema defining an unbounded sequence, from
> which I generate Java code, with which I want to unmarshal XML data,
> but cannot get this to work.

A colleague suggested that I might be able to work around the problem by
changing the schema from:

---------------------------------------- small2.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
    <xs:element name="parameters">
        <xs:complexType>
            <xs:sequence maxOccurs="unbounded">
                <xs:element name="thing" type="xs:string"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
---------------------------------------- small2.xsd

to:

---------------------------------------- small2a.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
    <xs:element name="parameters">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="thing" type="xs:string"
                            maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
---------------------------------------- small2a.xsd

i.e., moving the "unboundedness" from the sequence to the element
inside. This works, and (moreover) is applicable to the rather more
complex schema that I am trying to work with (and without a mapping file
being needed).

So the lesson appears to be: if you want an unbounded sequence, the
simplest thing to do is to instead introduce an intermediate element,
and make *that* unbounded instead, since Castor treats those very
nicely.

Tony Ibbs
--
Tony Ibbs, Senior Software Engineer, Laser-Scan Ltd.
[+44]1223 420414 - http://www.laser-scan.com

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

Reply via email to