all groups > dotnet xml > august 2004 >
You're in the

dotnet xml

group:

XmlSchema classes help needed


XmlSchema classes help needed a701440 NO[at]SPAM hotmail.com
8/30/2004 6:51:42 AM
dotnet xml:
Hi All,

I am having hard time figuring out how to programmatically construct a
schema with following comple type:

<xs:complexType name="A">
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="B" type="B" />
<xs:element minOccurs="1" maxOccurs="1" name="C" type="C" />
</xs:sequence>
<xs:anyAttribute>
</xs:complexType>

Specifically I can not find any way to insert the
"XmlSchemaAnyAttribute" instance into the complex type I have. Any
help would be appreciated.

The code I have looks something like:

.....

XmlSchemaComplexType xmlElementType = new XmlSchemaComplexType();
xmlElementType.Name = "A";

// Add nested elements
XmlSchemaSequence xmlNestedSequence = new XmlSchemaSequence();
xmlElementType.Particle = xmlNestedSequence;

XmlSchemaElement nestedElement;

nestedElement = new XmlSchemaElement();
nestedElement.Name = "B";
nestedElement.SchemaTypeName = new XmlQualifiedName("B");
nestedElement.MinOccurs = 1;
nestedElement.MaxOccurs = 1;

xmlNestedSequence.Items.Add(nestedElement);

nestedElement = new XmlSchemaElement();
nestedElement.Name = "C";
nestedElement.SchemaTypeName = new XmlQualifiedName("C");
nestedElement.MinOccurs = 1;
nestedElement.MaxOccurs = 1;

xmlNestedSequence.Items.Add(nestedElement);

Re: XmlSchema classes help needed Zafar Abbas [MSFT]
8/30/2004 1:03:15 PM
Doesnt this work for you?
XmlSchemaAnyAttribute any = new XmlSchemaAnyAttribute();

xmlElementType.AnyAttribute = any;



-Zafar



[quoted text, click to view]

AddThis Social Bookmark Button