To answer my own question: it is not possible to map
two QNames to the same class. If you try this:
<qname name="test:AType" javaname="SimpleType" />
<qname name="test:BType" javaname="SimpleType" />
XmlBeans generates two clases 'SimpleType' and 'SimpleType2'.
This is totally correct, because otherwise you couldn't
generate XML, because the information which type to use would
have been lost.
(as so often, I just forgot the other direction of the mapping)
Robin Sander wrote:
Hello Mike,
I haven't used element-groups or attribute-groups yet, but have
a similar problem: when a schema defines many different named
types (or types in different schemas/namespaces) which all have
identical content it would be great to be able to tell XmlBeans
to use the same class for all those types. Maybe by manually
specifying them in xsdconfig.
Or is this already possible by mapping different QNames to the
same java name? (I havent't tried this yet ... my fault)
Considering your problem: XmlBeans mimics the type hierarchy of
a schema, not the elements, so I think it would not be easy to
map a group of elements to one class.
But I'm not sure about that, maybe a kind of pseudo-type could
be used internally for that purpose.
regards,
Robin.
Mike Skells wrote:
Hi,
I have reposted this due to the underwhelming response :(
Do people think that this is a good idea?
Is it available currently or should I file an RFE?
...
Is anyone out there?
Mike
------------------------------------------------------------------------
*From:* Mike Skells [mailto:[EMAIL PROTECTED]
*Sent:* 08 September 2005 14:57
*To:* dev@xmlbeans.apache.org
*Subject:* representation of xs:group and xs:attributeGroup, and
polymorphic classes
Hi,
I am generating a series of java classes based on schemas
which make
heavy use in groups and attribute groups
Is there any way to get the generated classes to marks and reuse
this commonallity
It woudl seem to me that these would map to other interfaces
e.g.
<xs:complexType name="WorkflowRulesType">
<xs:complexContent>
<xs:extension base="local:WorkflowRules-interfaceType">
<xs:sequence>
<xs:group ref="local:workflow-content"/>
</xs:sequence>
<xs:attributeGroup ref="local:workflow-attributes"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
...
<xs:complexType name="WorkflowType">
<xs:complexContent>
<xs:extension base="local:Workflow-interfaceType">
<xs:sequence>
<xs:group ref="local:workflow-content"/>
</xs:sequence>
<xs:attributeGroup ref="local:workflow-attributes"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
I get a class
public interface WorkflowRulesType extends
WorkflowRulesInterfaceType
and
public interface WorkflowType extends WorkflowInterfaceType
each with an identical set of methods that relate to the content
Wouldnt it be more logical to get
public interface WorkflowsRulesType extends
WorkflowsRulesInterfaceType, WorkflowAttributes, WorkflowContent
public interface WorkflowsType extends WorkflowsRulesInterfaceType,
WorkflowAttributes, WorkflowContent
Is there a way to get xmlbeans to generate the additional
methods to
aid the polymorphic behaviors
Mike
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]