Werner, I've created a simplified schema and XML document that illustrate the problem and have attached them to the issue http://jira.codehaus.org/browse/CASTOR-2199.
Thanks, Nate > -----Original Message----- > From: Werner Guttmann [mailto:[EMAIL PROTECTED] > Sent: Friday, October 19, 2007 3:08 AM > To: [email protected] > Subject: Re: [castor-user] Generating code for elements with > mixed content > > Nathan, > > I am not 100% sure, but it could be that > > a) you have come across a bug. > b) there's problems with your XML schema. > > Looking at the XML schema fragments as given below, I think that > > <nxce:assignedAltitude> > <nxce:simpleAltitude>160</nxce:simpleAltitude> > </nxce:assignedAltitude> > > is not valid XML, as it lacks an 'above' attribute. In any > case, can you please raise a new Jira issue and attach a > *minimal* XML schema fragment as well as a minimal > (corresponding) XML document instance that validates against > the XML schema given. > > Werner > > > > Mittler, Nathan wrote: > > Hi, > > I'm having an issue generating proper Java code for a 3rd > party schema. > > I'm using Castor 1.1.2.1 with the castor-maven-plugin 1.0. I can > > generate all of the code fine, but when I try to extract an object > > from a sample data feed, I get the exception: > > > > java.io.IOException: Illegal Text data found as child of: > simpleAltitude > > value: "060" > > at parser.MyUnmarshaller.unmarshalOutput(MyUnmarshaller.java:36) > > at > > parser.MyUnmarshallerTest.testReadOutput(MyUnmarshallerTest.java:44) > > ... > > > > One instance of this element in the data feed looks like so: > > > > <nxce:assignedAltitude> > > <nxce:simpleAltitude>160</nxce:simpleAltitude> > > </nxce:assignedAltitude> > > > > The definition for the element "simpleAltitude" is shown below: > > > > <xsd:element name="simpleAltitude"> > > <xsd:complexType> > > <xsd:simpleContent> > > <xsd:extension base="simpleAltitudeType"> > > <xsd:attribute name="above" type="xsd:boolean"> > > </xsd:attribute> > > </xsd:extension> > > </xsd:simpleContent> > > </xsd:complexType> > > </xsd:element> > > > > Which extends from the simple type simpleAltitudeType: > > > > <xsd:simpleType name="simpleAltitudeType"> > > <xsd:restriction base="xsd:string"> > > <xsd:pattern value="[0-9]{0,3}[C,T]{0,1}"/> > > </xsd:restriction> > > </xsd:simpleType> > > > > When I generated the code, the SimpleAltitude class was > only given two > > properties: > > > > boolean _above; > > boolean _has_above; > > > > These are both related to the "above" attribute in the schema > > definition for "simpleAltitude". The class does not, > however, have a > > property to hold the text data for the "simpleAltitude" > element (i.e. > > "160"). This seems to be the cause of the exception. > > > > Is there a configuration option I can set to generate this > property? > > If not, is there a way to write a custom binding for this > particular > > element, such that I can force the creation of a property > to hold the > > text data? > > > > Thanks in advance for the help! > > > > Regards, > > Nate > > > > > > > --------------------------------------------------------------------- > > To unsubscribe from this list please visit: > > > > http://xircles.codehaus.org/manage_email > > > > > > > --------------------------------------------------------------------- > To unsubscribe from this list please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email

