diff --git a/XmlSchemaClassGenerator/ModelBuilder.cs b/XmlSchemaClassGenerator/ModelBuilder.cs index e8c69ba2..81347c5e 100644 --- a/XmlSchemaClassGenerator/ModelBuilder.cs +++ b/XmlSchemaClassGenerator/ModelBuilder.cs @@ -448,6 +448,7 @@ private IEnumerable 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, }; @@ -522,6 +523,7 @@ private IEnumerable 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, diff --git a/XmlSchemaClassGenerator/TypeModel.cs b/XmlSchemaClassGenerator/TypeModel.cs index 7fbe02c5..76eba060 100644 --- a/XmlSchemaClassGenerator/TypeModel.cs +++ b/XmlSchemaClassGenerator/TypeModel.cs @@ -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 Documentation { get; private set; }