I may be wrong, but doesn't your schema violate the UPA rule? If your
xml contains a crosspoint, which item in the sequence would it belong
to? #1 or #2? So perhaps XmlBeans gets confused?
<xs:sequence>
<xs:element ref="crosspoint" /> <!-- #1 -->
<xs:sequence>
<xs:element ref="track-info" />
<xs:element ref="crosspoint" /> <!-- #2 -->
</xs:sequence>
</xs:sequence>
________________________________
From: Thomas Zirnsack [mailto:[EMAIL PROTECTED]
Sent: Sunday, May 13, 2007 11:10 PM
To: [email protected]
Subject: Missing methods in generated classes (version 2.2.x)
Hi,
Got a little problem with the following XML:
<crosspoints>
<crosspoint/>
<track-info/>
<crosspoint/>
<track-info/>
<crosspoint/>
</crosspoints>
That means: Within <crosspoints> if have n <crosspoint>
tags and n-1 <track-info> tags.
My (generated from a DTD) schema for this xml structure looks
like this:
<xs:element name="crosspoints">
<xs:complexType>
<xs:sequence>
<xs:element ref="crosspoint" />
<xs:sequence>
<xs:element ref="track-info" />
<xs:element ref="crosspoint" />
</xs:sequence>
</xs:sequence>
</xs:complexType>
</xs:element>
When I use this schema w/ scomp the generated
class for <crosspoints> provide methods to get
all <crosspoint>s, but no method to get all
<track-info>s.
There is a methode in the Crosspoints (mind the
plural) class that retrieves just the first
<track-info> node. See the code below and mind
my comments.
private void transformCrosspoints(CrosspointsDocument.Crosspoints
crosspoints)
{
String indent = " ";
Crosspoint cp;
// This gives me the first <track-info>
TrackInfoDocument.TrackInfo ti = crosspoints.getTrackInfo();
// Cool all crosspoints... I miss this for <track-info>s
// No, there is no crosspoints.getTrackInfoArray();
Crosspoint cps[] = crosspoints.getCrosspointArray();
int points = cps.length;
for(int i=0; i < points; i++) {
pdfXml.append(indent + "<crosspoint>\n");
cp = cps[i];
// I see no way to get the <track-info> that follows this
'cp'
String dist = cp.getDistance();
pdfXml.append(indent + indent + "<cpdata
name=\"dist\">"+dist+"</data>\n");
pdfXml.append(indent + "<crosspoint>\n");
}
}
I feel that I got something totally wrong.
Is it the recursive schema? Well, any help
would be appreciated.
Kind regards,
tom
This email and any attachments may contain confidential or privileged
information. Please note that unauthorized copying, disclosure or
distribution of the material in this email is not permitted.
GfK Data Services GmbH, Nuremberg, Germany, commercial register
Nuremberg HRB 11415; Managing Director: Rainer Ostermeyer