You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Sandy Gao <sa...@ca.ibm.com> on 2003/08/06 01:01:42 UTC

Re: exploring the innards of a WXS derived complex type definition

> The question is, if I get the grammar containing this type and convert it
to an XSModel, how can I find the all-important wsdl:arrayType attribute
value, ...

No way. Qualified attributes (those with prefixes) in schema documents are
not retained in the schema grammar / XSModel, because the schema spec
didn't require that.

You could have tried using <annotation>,

             <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType
="typens:ResultElement[]">
               <xsd:annotation> ... </xsd:annotation>
             </xsd:attribute>

but (unfortunately) the schema spec has a bug and forgot to include an
"annotation" property in "attribute use" components, so the <annotation> is
also lost. But for other components, you can use <annotation>s to capture
qualified attributes.

> Is it possible to examine the contents of the restriction, rather than
only determine the base type and the derivation method?

The {content type} (getParticle() on XSComplexTypeDefinition) of the
derived type *is* the content of the restriction.

HTH,
Sandy Gao
Software Developer, IBM Canada
(1-905) 413-3255
sandygao@ca.ibm.com



                                                                                                                                 
                      "Jeff Greif"                                                                                               
                      <jgreif@alumni.pri        To:       <xe...@xml.apache.org>                                         
                      nceton.edu>               cc:                                                                              
                                                Subject:  exploring the innards of a WXS derived complex type definition         
                      07/25/2003 10:01                                                                                           
                      PM                                                                                                         
                      Please respond to                                                                                          
                      xerces-j-user                                                                                              
                                                                                                                                 
                                                                                                                                 



Lots of Web Services using SOAP contain XML Schema type definitions like
this:

      <xsd:complexType name="ResultElementArray">
        <xsd:complexContent>
          <xsd:restriction base="soapenc:Array">
             <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType
="typens:ResultElement[]"/>
          </xsd:restriction>
        </xsd:complexContent>
      </xsd:complexType>

(The base type is given below).

When a SOAP/WSDL processor reads this type, it can determine via special
knowledge (out of band as far as WXS is concerned) based on presence of the
soapenc:arrayType attribute and the wsdl:arrayType attribute value that an
element of type ResultElementArray may contain an unrestricted number of
child elements (with any name allowed -- see the base type) of type
ResultElement.

When an instance document is encountered, it might look like this
<return arrayType="ResultElement[3]" xsi:type="ResultElementArray">
   <item xsi:type="ResultElement">...</item>
   <item xsi:type="ResultElement">...</item>
   <item xsi:type="ResultElement">...</item>
</return>
and the SOAP processor can determine from the arrayType value that there
will be three child elements of type ResultElement.

The question is, if I get the grammar containing this type and convert it
to an XSModel, how can I find the all-important wsdl:arrayType attribute
value, (and thus be able to emulate the SOAP/WSDL processor's knowledge of
the content, without having an instance document to look at)?  Is this
information captured somewhere in the XSModel?  Is it possible to examine
the contents of the restriction, rather than only determine the base type
and the derivation method?

Jeff

Note:
The base type, somewhat simplified, is from the SOAP-Encoding spec:
  <xs:complexType name="Array" >
    <xs:sequence>
      <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded"
processContents="lax" />
    </xs:sequence>
    <xs:attribute name="arrayType" type="xs:string" />
    <xs:attribute name="arrayOffset" type="xs:string"/>
    <xs:anyAttribute namespace="##other" processContents="lax" />
  </xs:complexType>




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org