Skip to content

Commit

Permalink
Fix #217
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Ganss committed Jul 28, 2020
1 parent bdc1c51 commit 1a94497
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion XmlSchemaClassGenerator/ModelBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,20 @@ private TypeModel CreateTypeModel(Uri source, XmlSchemaComplexType complexType,
// If it's a restriction, do not duplicate attributes on the derived class, they're already in the base class.
// See https://msdn.microsoft.com/en-us/library/f3z3wh0y.aspx
}
else { attributes = complexType.Attributes; }
else
{
attributes = complexType.Attributes;

if (attributes.Count == 0 && complexType.ContentModel != null)
{
var content = complexType.ContentModel.Content;

if (content is XmlSchemaComplexContentExtension extension)
attributes = extension.Attributes;
else if (content is XmlSchemaComplexContentRestriction restriction)
attributes = restriction.Attributes;
}
}

if (attributes != null)
{
Expand Down

0 comments on commit 1a94497

Please sign in to comment.