Microsoft KB Archive/317548

= XmlSchemaAttributeGroup contains a Public property that is named RedefinedAttributeGroup =

Article ID: 317548

Article Last Modified on 9/15/2005

-

APPLIES TO


 * Microsoft .NET Framework Class Libraries 1.1
 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2003 Professional Edition
 * Microsoft .NET Framework 1.0

-



This article was previously published under Q317548



SUMMARY
The XmlSchemaAttributeGroup contains a Public property called RedefinedAttributeGroup that is not documented in Microsoft Developer Network (MSDN). This is a read-only property and retrieves the redefined attribute group from the XSD schema.



MORE INFORMATION
The following sample shows how to use the RedefinedAttributeGroup property.

NOTE: This is a read-only property when you query the XSD schema.  Create a new Microsoft Visual Basic .NET console application.  Replace the code in the Module1.vb file with the following code: Module Module1

Dim xReader As System.Xml.XmlReader = New System.Xml.XmlTextReader(&quot;c:\test.xml&quot;) Dim xValidator As System.Xml.XmlValidatingReader = New System.Xml.XmlValidatingReader(xReader) Dim sQualifiedName As System.Xml.XmlQualifiedName = New System.Xml.XmlQualifiedName(&quot;car&quot;) Dim sGroup As System.Xml.Schema.XmlSchemaAttributeGroup

Sub Main xValidator.Schemas.Add(&quot;&quot;, &quot;c:\test.xsd&quot;) xValidator.ValidationType = System.Xml.ValidationType.Schema

sGroup = xValidator.Schemas.Item(&quot;&quot;).AttributeGroups(sQualifiedName)

Console.WriteLine(&quot;Name: &quot; & sGroup.RedefinedAttributeGroup.Name & vbCrLf) Console.WriteLine(&quot;LineNumber: &quot; & sGroup.RedefinedAttributeGroup.LineNumber & vbCrLf) Console.WriteLine(&quot;LinePosition: &quot; & sGroup.RedefinedAttributeGroup.LinePosition & vbCrLf) Console.WriteLine(&quot;Namespaces Count: &quot; & sGroup.RedefinedAttributeGroup.Namespaces.Count & vbCrLf) Console.WriteLine(&quot;SourceUri: &quot; & sGroup.RedefinedAttributeGroup.SourceUri & vbCrLf)

Console.Read

End Sub

End Module   Paste the following Extensible Markup Language (XML) code into a file in the C:\ directory and name it &quot;Test.xml&quot; (without quotation marks):     Paste the following XML code into a file in the C:\ directory and name it &quot;Test.xsd&quot; (without quotation marks):    <xsd:attributeGroup name=&quot;car&quot;> <xsd:attributeGroup ref=&quot;car&quot; /> </xsd:attributeGroup> </xsd:redefine> <xsd:attribute name=&quot;att1&quot; type=&quot;xsd:string&quot; /> <xsd:attributeGroup name=&quot;ext&quot;> <xsd:attributeGroup ref=&quot;car&quot; /> </xsd:attributeGroup> <xsd:element name=&quot;doc&quot;> <xsd:complexType> <xsd:sequence> <xsd:element name=&quot;test&quot;> <xsd:complexType> <xsd:attributeGroup ref=&quot;ext&quot; /> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </li>  Paste the following XML code into a file in the C:\ directory and name it &quot;Testredefine.xsd&quot; (without quotation marks): <xsd:schema xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;> <xsd:attribute name=&quot;model&quot; type=&quot;xsd:string&quot; /> <xsd:attributeGroup name=&quot;car&quot;> <xsd:attribute name=&quot;model&quot; /> <xsd:attribute name=&quot;age&quot; type=&quot;xsd:int&quot; /> <xsd:attribute name=&quot;attFix&quot; type=&quot;xsd:int&quot; fixed=&quot;37&quot; /> </xsd:attributeGroup> <xsd:attributeGroup name=&quot;truck&quot;> <xsd:attribute name=&quot;model&quot; /> <xsd:attribute name=&quot;age&quot; type=&quot;xsd:int&quot; /> </xsd:attributeGroup> <xsd:complexType name=&quot;Address1&quot;> <xsd:complexContent> <xsd:extension base=&quot;Address&quot;> <xsd:sequence> <xsd:element name=&quot;country&quot; type=&quot;xsd:string&quot; /> </xsd:sequence> </xsd:extension> </xsd:complexContent> </xsd:complexType> <xsd:complexType name=&quot;Address&quot;> <xsd:sequence> <xsd:element name=&quot;name&quot; type=&quot;xsd:string&quot; /> <xsd:element name=&quot;street&quot; type=&quot;xsd:string&quot; /> <xsd:element name=&quot;city&quot; type=&quot;xsd:string&quot; /> </xsd:sequence> </xsd:complexType> </xsd:schema> </li>  Compile and run the application. The following output should appear: Name: car LineNumber: 3 LinePosition: 3 Namespaces Count: 0 SourceUri: file:///c:/testredefine.xsd </li></ol>

Keywords: kbbug kbdocerr kbpending kbvs2002sp1sweep KB317548

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.