Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / November 2005

Tip: Looking for answers? Try searching our database.

how do you add an xml schema attributegroup to a complextype extension?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
comic_rage@yahoo.com - 03 Nov 2005 18:49 GMT
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);

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.