Groups | Blog | Home
all groups > dotnet xml > august 2003 >

dotnet xml : xml schema in wsdl


Suresh
8/20/2003 4:48:42 PM
Hello All,
I have a schema ( XSD) as follows.
- <xs:complexType name="Tzp3wsXSPOP3MessageArray">
- <xs:complexContent>
- <xs:restriction base="soapenc:Array">
<xs:sequence />
<xs:attribute ref="soapenc:arrayType"
n1:arrayType="ns1:Tzp3wsXSPOP3Message[]"
xmlns:n1="http://schemas.xmlsoap.org/wsdl/" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>
- <xs:complexType name="Tzp3wsXSPOP3Message">
- <xs:sequence>
<xs:element name="Body" type="xs:string" />
<xs:element name="Date" type="xs:dateTime" />
<xs:element name="From" type="xs:string" />
<xs:element name="Size" type="xs:int" />
<xs:element name="Subject" type="xs:string" />
<xs:element name="UID" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:schema>

I get the complextype name as Tzp3wsXSPOP3MessageArray,
now I need to go to the attribute ref element annd get the
array type as "Tzp3wsXSPOP3Message[]".
The problem is how do I get to <xs:attribute ref> element
since I dont find any property in XmlSchemaSequence class
that gets me there. The "items" property is null in the
above given case.Am I missing anything?
Once i get the array I need to go to that particular type
i.e "Tzp3wsXSPOP3Message" and expand it.
The above schema is a part of a WSDL file.
Iam using C# on .NET.

Thanks for your time.
Regards
Dan Wahlin
8/24/2003 4:53:38 PM
You won't be able to get to the attribute definition from the sequence since
attributes are contained in complexTypes. From a complexType you can easily
get to the attribute definitions though using code such as:

//Iterate through attribute definitions within complexType
foreach (XmlSchemaObject attribute in complexType.Attributes) {
XmlSchemaAttribute att = (XmlSchemaAttribute)attribute;
//work with att here
}

You'd of course need to write code to track down the attribute reference to
get more details. I posted a more complete example that should help get you
started at the following URL if you're interested:

http://www.xmlforasp.net/codeSection.aspx?csID=78

Dan Wahlin

Wahlin Consulting
Microsoft MVP - ASP.NET and XML Web Services
http://www.xmlforasp.net


[quoted text, click to view]

AddThis Social Bookmark Button