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 "Yoshida, Akitoshi" <ak...@sap.com> on 2004/07/23 12:29:27 UTC

problems with wsdl2java: in using global xml attribute declarati ons

Hi,

I have some problems in generating classes that have global attributes in their corresponding XML schema definitions.

For example, when I use the following schema:
<xs:schema ...
  targetNamespace="http://foo-com/xi"
  xmlns:xi="http://foo-com/xi" 
  xmlns:xs="http://www.w3.org/2001/XMLSchema">

<!-- global attribute AttrOne -->
<xs:attribute name="AttrOne" type="xs:string"/>

<!-- global attribute AttrTwo -->
<xs:attribute name="AttrTwo">
  <xs:simpleType>
    <xs:restriction base="xs:string"/>
  </xs:simpleType>
</xs:attribute>

<!-- global element ElemOne -->
<xs:element name="ElemOne" type="xs:string"/>

<!-- global type TypeOne -->
<xs:complexType name="TypeOne">
  <xs:sequence>
    <xs:element ref="xi:ElemOne"/>
    <xs:element name="ElemTwo" type="xs:string"/>
  </xs:sequence>
  <xs:attribute ref="xi:AttrTwo"/>
  <xs:attribute name="AttrThree" type="xs:string"/>
</xs:complexType>

</xs:schema>


The first problem is that I get class _AttrTwo for attribute AttrTwo, but there is no class generated for attribute AttrOne. In other words, I cannot declare a global attribute using <xs:attribute name="..." type="..."/>.

The second problem is that the generated class for TypeOne contains the attributes for the global and local child elements ElemOne and ElemTwo but contains the attribute for only the local attribute AttrThree and not the global one AttrTwo. This means I can reference a global element by <xs:element ref="..."/> but I cannot reference a global attribute by <xs:attribute ref="..."/>.

Can someone tell me if these are bugs in WSDL2Java or there is some setting I can use to prevent solve these problems?

Thank You in advance.

Aki Yoshida