adding user defined type to an attribute node
---------------------------------------------

                 Key: WSCOMMONS-143
                 URL: http://issues.apache.org/jira/browse/WSCOMMONS-143
             Project: WS-Commons
          Issue Type: Test
          Components: XmlSchema
         Environment: windows xp, java
            Reporter: Pradeep Patel
            Priority: Trivial


hi,
 i am generating an wsdl file dynamically. for that i am creating an xml schema 
for types. For array data types i want to use SOAP-ENCODIG 
"http://schemas.xmlsoap.org/soap/encoding/";.

I want to create schema structure like this:-
<xsd:complexType name="_SE_S.field_ArrayOfint">
    <xsd:complexContent >
        <xsd:restriction base="SOAP-ENC:Array" >
            <xsd:sequence >
                <xsd:element name="item" type="xsd:int" minOccurs="10" 
maxOccurs="10"/>
            </xsd:sequence>
            <xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd:int[]"/>
        </xsd:restriction>
    </xsd:complexContent>
</xsd:complexType>

but here i am not able to create new type as "wsdl:arrayType".
This is the sample code form my applicaton:-

XmlSchema xmlSchema = getXmlSchema(schemaTargetNameSpace);
                
XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema);
XmlSchemaComplexContent complexContent = new XmlSchemaComplexContent();
XmlSchemaComplexContentRestriction complexRestr = new 
XmlSchemaComplexContentRestriction();
XmlSchemaSequence sequence = new XmlSchemaSequence();
                                
QName schemaTypeName = new QName(schemaTargetNameSpace, name, 
schema_namespace_prefix);

XmlSchemaAttribute attrRestr = new XmlSchemaAttribute();
QName schemaRefName = new QName(SOAP_ENCODING_NAMESPACE, "arrayType", 
SOAP_ENC_PREFIX);
attrRestr.setRefName(schemaRefName);
            
QName restrBaseTypeName = new QName(SOAP_ENCODING_NAMESPACE, "Array", 
SOAP_ENC_PREFIX);
complexRestr.setBaseTypeName(restrBaseTypeName);
complexRestr.setParticle(sequence);
complexRestr.getAttributes().add(attrRestr);
            
complexContent.setContent(complexRestr);//erstriction added
            
complexType.setContentModel(complexContent);//complexContent added
complexType.setName(name);
complexType.setMixed(true); // for .NET support
                
XmlSchemaElement seqContent = new XmlSchemaElement();
seqContent.setName("item");
seqContent.setSchemaTypeName(seqSchemaTypeName);
seqContent.setMaxOccurs(Long.MAX_VALUE);
seqContent.setMinOccurs(0);
            
sequence.getItems().add(seqContent);
xmlSchema.getItems().add(complexType);
xmlSchema.getSchemaTypes().add(schemaTypeName, complexType);

can you please help me generate the schema?
also can you please refer any user guides which contains the sample codes and 
api definitions to create xml schema?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to