Skip to content

Commit

Permalink
Expose XmlSchemaAttribute.FixedValue
Browse files Browse the repository at this point in the history
  • Loading branch information
antony-male-sagentia committed Jan 3, 2019
1 parent 746e7b6 commit 1baf016
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions XmlSchemaClassGenerator/ModelBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ private IEnumerable<PropertyModel> CreatePropertiesForAttributes(Uri source, Typ
IsAttribute = true,
IsNullable = attribute.Use != XmlSchemaUse.Required,
DefaultValue = attribute.DefaultValue ?? (attribute.Use != XmlSchemaUse.Optional ? attribute.FixedValue : null),
FixedValue = attribute.FixedValue,
Form = attribute.Form == XmlSchemaForm.None ? attribute.GetSchema().AttributeFormDefault : attribute.Form,
XmlNamespace = attribute.QualifiedName.Namespace != "" && attribute.QualifiedName.Namespace != typeModel.XmlSchemaName.Namespace ? attribute.QualifiedName.Namespace : null,
};
Expand Down Expand Up @@ -522,6 +523,7 @@ private IEnumerable<PropertyModel> CreatePropertiesForElements(Uri source, TypeM
IsNullable = item.MinOccurs < 1.0m || (item.XmlParent is XmlSchemaChoice),
IsCollection = item.MaxOccurs > 1.0m || particle.MaxOccurs > 1.0m, // http://msdn.microsoft.com/en-us/library/vstudio/d3hx2s7e(v=vs.100).aspx
DefaultValue = element.DefaultValue ?? ((item.MinOccurs >= 1.0m && !(item.XmlParent is XmlSchemaChoice)) ? element.FixedValue : null),
FixedValue = element.FixedValue,
Form = element.Form == XmlSchemaForm.None ? element.GetSchema().ElementFormDefault : element.Form,
XmlNamespace = element.QualifiedName.Namespace != "" && element.QualifiedName.Namespace != typeModel.XmlSchemaName.Namespace ? element.QualifiedName.Namespace : null,
XmlParticle = item.XmlParticle,
Expand Down
1 change: 1 addition & 0 deletions XmlSchemaClassGenerator/TypeModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ public class PropertyModel
public bool IsNillable { get; set; }
public bool IsCollection { get; set; }
public string DefaultValue { get; set; }
public string FixedValue { get; set; }
public XmlSchemaForm Form { get; set; }
public string XmlNamespace { get; set; }
public List<DocumentationModel> Documentation { get; private set; }
Expand Down

0 comments on commit 1baf016

Please sign in to comment.