I think it will be ok. I believe our XSD was hand-coded and prone to
inconsistancies.
Man, I can't thank you enough. You saved some of my hair from being
pulled out with the rest of it!
Werner Guttmann wrote:
Not to my knowledge. If you allow a little bit of incorrectness in the
next statement, any unboundedness will result in the generation of *Item
classes (whether choices or not). And I guess removing
maxOccurs="unbounded" would alter the semantics of your XML schema.
Werner
Dan Jones wrote:
Thank you so much...
Is there anything I can do to the XSD. It's a rather large XSD, but
whatever changes I need to make to it let me know.
For instance, if a "choice" is not "unbounded", or if each "element" was
"unbounded" or ??
Werner Guttmann wrote:
Dan,
I don't think you'll have a choice here, as the *Items classes are
generated as a result of you using (I believe) an unbounded <xs:choice>
element. In other words, Castor will use certain rules to determine the
names of the classes generated, and you are being 'hit' by one of these
rules.
Unfortunately, Castor's main mechanism to override these naming schemes
(the binding file) does not allow the granularity required to override
the class name of an *Item class.
Regards
Werner
Dan Jones wrote:
I am using the Code Generator for the first time, to generate an XSD
into Java classes.
I would like to not have all of the *Item classes. For example:
If my XML looks like:
<message>
<responses>
<alert>hello</alert>
</responses>
</message>
I would like in Java to call
if (message.getResponses() != null){
Responses resp = message.getResponses(0);
resp.getAlert(0);
// ... and so on
}
instead of
if (message.getResponses() != null){
for (int i =0; i < message.getResponses().getResponsesItemCount(); i++){
ResponsesItem ri = message.getResponses().getResponseItem(i);
// or you get the idea
}
}
How can I acheive that? (Classes generated with all of the *Item classes)
Example XSD:
<xsd:element name="message" >
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<!--responses-->
<xsd:element name="responses">
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element ref="alert"/>
... And close all the elements....
Any hints or advice? I'm definately not an expert in XSD...
P.S> I've tried to search my brains out in this mailing group, but I
can't find what I'm looking for.
---------------------------------------------------------------------
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
---------------------------------------------------------------------
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
|