I am trying to get my schema to look like this
<xsd:extension base="MyExtension">
<xsd:attributeGroup ref="DocumentAttributes">
<xsd:annotation>
<xsd:documentation>Notes</xsd:documentation>
</xsd:annotation>
</xsd:attributeGroup>
</xsd:extension>
I know I need to add the attributeGroup to the complextype extension
I coded as so
MyComplexTypeExtension.Attribute.Add(AttributeGroup);
When I call the streamwriter to write the schema to a file, an
exception error is thrown.
Anyone know the correct code to do this?
Thanks
Zafar Abbas - 03 Nov 2005 20:15 GMT
Make sure that the object you add to the extension is a
XmlSchemaAttributeGroupRef.
Please post your code and data if it is still a problem.
Zafar
> I am trying to get my schema to look like this
>
[quoted text clipped - 18 lines]
>
> Thanks
comic_rage@yahoo.com - 03 Nov 2005 21:02 GMT
XmlSchemaComplexContentExtension cce =
CreateExtensionBase("MyComplexContentExt");
XmlSchemaAttributeGroup DocAttrGroup =
CreateAttributeGroup("MyAttributeGroup);
XmlSchemaAnnotation annot = new XmlSchemaAnnotation();
XmlSchemaDocumentation doc = new XmlSchemaDocumentation();
XmlDocument doc = new XmlDocument();
XmlSchemaAnnotation annot = new XmlSchemaAnnotation();
XmlNode newNode = new XmlNode[1]{ doc.CreateTextNode(strText)};
doc.Markup = newNode;
annot.Items.Add(doc);
DocAttrGroup.Annotation = annot;
cce.Attributes.Add(DocAttrGroup);
Zafar Abbas - 04 Nov 2005 20:14 GMT
You are adding an object of type XmlSchemaAttributeGroup to the Attributes
collection. It should be of the type XmlSchemaAttributeGroupRef.
> XmlSchemaComplexContentExtension cce =
> CreateExtensionBase("MyComplexContentExt");
[quoted text clipped - 9 lines]
> DocAttrGroup.Annotation = annot;
> cce.Attributes.Add(DocAttrGroup);