Hi,
I raised the opposite of the "container" issue a few days ago, but
so far no replies. So here goes again. Suppose
there are elements in the XML whose sole function
is grouping other elements:
eg Inside my root element called 'farm-animals' I have a
'horses' element with multiple 'horse elements inside
I want to unmarshall such a document so that I have multiple Horse
objects in
a collection, in a FarmAnimals object, but I don't want to support a
class called
Horses whose only function is to contain a Java Collection of Horse
objects. Is
there a way, using the current mapping file, to translate such an
element to a
collection of Horses directly inside a FarmAnimals object (and vice versa)?
I am beginning to conclude that the answer is 'No' and have learned
quite
a lot about XSLT over the last few days as a result, but if there is a
way, it
would make life simpler. Thanks for any ideas.
Regards,
David Roytenberg
[EMAIL PROTECTED] wrote:
>Hi Arnaud,
>
>the Sourcegenerator from the latest CVS version sometimes generates classes
>that are of no use:
>
><?xml version="1.0" encoding="UTF-8"?>
><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>elementFormDefault="qualified" attributeFormDefault="unqualified">
> <xs:element name="Test">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="Any" type="AnyType"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:simpleType name="AnyType">
> <xs:restriction base="xs:string">
> <xs:enumeration value="a"/>
> <xs:enumeration value="b"/>
> </xs:restriction>
> </xs:simpleType>
></xs:schema>
>
>In this case Sourcegenerator generates the classes Test.java (ok),
>types/AnyType.java (ok)and Any.java, which only contains a constructor and
>the marshalling/unmarshalling methods and is not referenced by Test.java.
>BTW: Thanks for eliminating the name clashing problem. The namespace
>workaround was driving me crazy :)
>
>Albert
>
>-----Original Message-----
>From: Arnaud Blandin [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, March 06, 2002 11:32 AM
>To: [EMAIL PROTECTED]
>Subject: [castor-dev] ANNOUNCEMENT: Container support -- Nested group
>
>
>Hi,
>
>A lot of changes have been made in the CVS version regarding container
>support.
>Let me remind you that a "container" is a Java object that holds other
>objects without having necessary a corresponding XML tag. You can think
>for instance of nested groups in an XML Schema: a sequence inside a
>choice will be represented by a class (FooChoiceSequence) but no XML tag
>will correspond to it.
>Containers are supported via the SourceGenerator or via the Mapping
>File.
>
>The code has been totally refactored and a new behaviour is now in
>place, it should get rid of all the famous "error-if-this-used"
>ValidationException and it improves the overall unmarshalling process.
>
>I advise anyone interested in Container support (or people who had
>trouble unmarshalling their XML document) to test the CVS version and
>let us know all the problems they encounter (you can also say that it is
>working and thank us for the good work :) ).
>
>Have fun,
>
>Arnaud
>
>PS: don't forget to regenerate the Object Model from the Schema
>
>-----------------------------------------------------------
>If you wish to unsubscribe from this mailing, send mail to
>[EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
>-----------------------------------------------------------
>If you wish to unsubscribe from this mailing, send mail to
>[EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev