The fact that Axis 1 didn't support xsd:union caused me a *LOT* of problems
because the schemas I have to work with are filled with constructs of the
form:
<xs:simpleType name="Action_request_flag" >
<xs:annotation>
<xs:appinfo>
send actions (1)
do not send actions (2)
</xs:appinfo>
</xs:annotation>
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:unsignedInt">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="2"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="send actions"/>
<xs:enumeration value="do not send actions"/>
</xs:restriction>
</xs:simpleType >
</xs:union>
</xs:simpleType>
This happens for pretty much every enumeration in a very large schema.
Since I didn't write these schemas and can't control what's in them (a
rather unresponsive standards body wrote them), I ultimately ended up having
to write an XSLT script to traverse my schema and replace all xs:unions with
equivalent constructs that didn't use unions. I don't recommend doing this
if you can possibly avoid it.
Even if Axis were to treat a union of simple types as an untyped string, I
think it would be far better than not supporting them at all.
I haven't tried this with Axis2 (XMLBeans) yet, so I don't know if the
situation is improved or not. I would be interested to hear if XMLBeans can
handle this case.
Derek
> -----Original Message-----
> From: Nathan Sowatskey [mailto:[EMAIL PROTECTED]
> Sent: Friday, July 07, 2006 9:23 AM
> To: [email protected]
> Cc: mTOP Reference Implementation Team
> Subject: Re: General approach for xsd:union?
>
>
> Well, that's certainly one approach, but xsd:unions are supported by
> some tools, but not others, and they are a valid construct.
>
> It is hard to argue that they shouldn't be used just because a given
> tool doesn't support them.
>
> I will look into the other options in any case.
>
> Many thanks
>
> Nathan
>
> Nathan Sowatskey - Technical Leader, NMTG CTO Engineering -
> +34-638-083-675, +34-91-201-2139 - AIM NathanCisco -
> [EMAIL PROTECTED]
>
> On 7 Jul 2006, at 18:07, Anne Thomas Manes wrote:
>
> >>> On the other hand, is there a better way entirely?
> XMLBeans perhaps?
> >
> > Yes. Don't use <xsd:union>.
> > Try <xsd:choice> instead.
> > Or maybe a substitution group.
> >
> > Anne
> >
> >
> > On 7/7/06, Nathan Sowatskey <[EMAIL PROTECTED]> wrote:
> >> Hi
> >>
> >> I guess we all know that xsd:union types are not supported
> for Axis
> >> 1.x, so we need to write our own de/serialisers.
> >>
> >> Does anyone have any useful guidance on how to do that please?
> >>
> >> On the other hand, is there a better way entirely?
> XMLBeans perhaps?
> >>
> >> Many thanks
> >>
> >> Nathan
> >>
> >> Nathan Sowatskey - Technical Leader, NMTG CTO Engineering -
> >> +34-638-083-675, +34-91-201-2139 - AIM NathanCisco -
> >> [EMAIL PROTECTED]
> >>
> >>
> ---------------------------------------------------------------------
> >> 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]
>
> ---------------------------------------------------------------------
> 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]