You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Peter Klotz <pe...@blue-elephant-systems.com> on 2003/06/15 13:14:00 UTC

WSDL2Java and mixed content XSD

Hi,

I have a WSDL with a type that can either include CDATA or additional
tags so real mixed content. I can't change this unfortunately.
Now I try to generate Java stubs/skeletons from this mixed content WSDL
snipplet.
When I have only text content I get a method String getValue() generated.
If I have a tag inside e.g. <seq> I get correct methods to get objects Seq.
But I could not make it that WSDL2Java would generate me a String
getValue() when I have the <seq>-Tags declared in the WSDL.

<xsd:complexType name="attributeValue" mixed="true">
   [<xsd:complexContent>]
     <xsd:attribute name="name" type="xsd:string" use="required"/>
     <xsd:attribute name="lang" type="xsd:string" use="optional"/>
     <xsd:attribute name="errorNumber" type="xsd:string" use="optional"/>
     <xsd:choice>
       <xsd:sequence>
         <xsd:element name="seq" type="omi:seq" maxOccurs="unbound"/>
       </xsd:sequence>
     </xsd:choice>
   [</xsd:complexContent>]
</xsd:complexType>

Either I'm doing something wrong in declaring the mixed content XSD or
WSDL2Java has a problem with this.

When I have the <xsd:complextContent> nothing is generated, without all
is generated but not getValue(). With simpleContent nothing is generated
again, but would also be wrong IMHO.

The XML to be described is

<attributeValue>somet txt</attributeValue>

or

<attributeValue><seq>sometext</seq><seq>more text</seq></attributeValue>

I definitely need a function getValue() to get the normal CDATA text in
case it has no sub-tags but this is just not generated by WSDL2Java.


Thanks, Peter



Re: WSDL2Java and mixed content XSD

Posted by Peter Klotz <pe...@blue-elephant-systems.com>.
Hi,

please does anybody know how Axis handles XML-Schema with mixed content 
in WSDL2Java? I tried to mix a generated class for CDATA with one that 
has tags to fix it manually but one can either use a SimpleDeserializer 
or a BeanDeserializer. Neither of those seems to be able to handle mixed 
content? So what can I do?

Thanks, Peter

Peter Klotz wrote:
> Hi,
> 
> I have a WSDL with a type that can either include CDATA or additional
> tags so real mixed content. I can't change this unfortunately.
> Now I try to generate Java stubs/skeletons from this mixed content WSDL
> snipplet.
> When I have only text content I get a method String getValue() generated.
> If I have a tag inside e.g. <seq> I get correct methods to get objects Seq.
> But I could not make it that WSDL2Java would generate me a String
> getValue() when I have the <seq>-Tags declared in the WSDL.
> 
> <xsd:complexType name="attributeValue" mixed="true">
>   [<xsd:complexContent>]
>     <xsd:attribute name="name" type="xsd:string" use="required"/>
>     <xsd:attribute name="lang" type="xsd:string" use="optional"/>
>     <xsd:attribute name="errorNumber" type="xsd:string" use="optional"/>
>     <xsd:choice>
>       <xsd:sequence>
>         <xsd:element name="seq" type="omi:seq" maxOccurs="unbound"/>
>       </xsd:sequence>
>     </xsd:choice>
>   [</xsd:complexContent>]
> </xsd:complexType>
> 
> Either I'm doing something wrong in declaring the mixed content XSD or
> WSDL2Java has a problem with this.
> 
> When I have the <xsd:complextContent> nothing is generated, without all
> is generated but not getValue(). With simpleContent nothing is generated
> again, but would also be wrong IMHO.
> 
> The XML to be described is
> 
> <attributeValue>somet txt</attributeValue>
> 
> or
> 
> <attributeValue><seq>sometext</seq><seq>more text</seq></attributeValue>
> 
> I definitely need a function getValue() to get the normal CDATA text in
> case it has no sub-tags but this is just not generated by WSDL2Java.
> 
> 
> Thanks, Peter