Skip to content

Commit

Permalink
Fix #531
Browse files Browse the repository at this point in the history
  • Loading branch information
mganss committed Nov 12, 2024
1 parent 1ae624e commit e44cd71
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 28 deletions.
71 changes: 44 additions & 27 deletions XmlSchemaClassGenerator.Tests/xsd/simple/any.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,48 @@
xmlns:mstns="http://tempuri.org/default.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:complexType name="AnyTest_ExtendedString">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:complexType name="AnyTest_Type">
<xs:sequence/>
<xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:complexType>

<xs:complexType name="AnyTest_ExtendedTypeWithAnyAttr">
<xs:complexContent>
<xs:extension base="AnyTest_Type">
<xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="AnyTest_ExtendedTypeWithoutAnyAttr">
<xs:complexContent>
<xs:extension base="AnyTest_Type" />
</xs:complexContent>
</xs:complexType>

<xs:complexType name="AnyTest_ExtendedString">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:complexType name="AnyTest_Type">
<xs:sequence/>
<xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:complexType>

<xs:complexType name="AnyTest_ExtendedTypeWithAnyAttr">
<xs:complexContent>
<xs:extension base="AnyTest_Type">
<xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="AnyTest_ExtendedTypeWithoutAnyAttr">
<xs:complexContent>
<xs:extension base="AnyTest_Type" />
</xs:complexContent>
</xs:complexType>

<xs:complexType name="SaleType">
<xs:attributeGroup ref="myAnyAttribute" />
</xs:complexType>

<xs:attributeGroup name="myAnyAttribute">
<xs:anyAttribute namespace="##other" />
</xs:attributeGroup>

<xs:complexType name="StockTypeBase" />
<xs:complexType name="StockType1">
<xs:complexContent>
<xs:extension base="StockTypeBase">
<xs:anyAttribute namespace="##other" />
</xs:extension>
</xs:complexContent>
</xs:complexType>

</xs:schema>
2 changes: 1 addition & 1 deletion XmlSchemaClassGenerator/ModelBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ private TypeModel CreateTypeModel(XmlSchemaComplexType complexType)
if (baseType is not XmlSchemaComplexType baseComplexType)
continue;

if (baseComplexType.AttributeWildcard != null)
if (baseComplexType.QualifiedName != AnyType && baseComplexType.AttributeWildcard != null)
{
hasAnyAttribute = false;
break;
Expand Down

0 comments on commit e44cd71

Please sign in to comment.