Attributes with - symbol are not generated
``I've recently using your XmlSchemcaClassGenerator tool and it seems that attributes which contains - characted in name, are not generated in final XML.
For example for attribute:
<xs:attribute name="ID-CLASS" type="xs:NMTOKEN" fixed="NAME"/>
Is there any solutions to this or is it a bug?
@EDIT
Actually it's different issue.
Because of default value of attribute with fixed="NAME", XSCGen generates this:
[System.Xml.Serialization.XmlIgnoreAttribute()]
private string _idclass = "NAME";
[System.ComponentModel.DefaultValueAttribute("NAME")]
[System.Xml.Serialization.XmlAttributeAttribute("ID-CLASS")]
public string Idclass
{
get
{
return _idclass;
}
set
{
_idclass = value;
}
}
where deleting [System.ComponentModel.DefaultValueAttribute("NAME")] solves my problem.
Why it's handled this way? How can this be solved?
Do you expect the DefaultValueAttribute not to be generated?
I do expect to have default value, that's correct.
It doesn't matter if its encapsulated by private string or with DefaultValueAttribute.
I expect to use that C# classes from schema to generate xml's with correct behaviour, so with example I gave, I expect to generate something like this:
<MY_TAG ID-CLASS="NAME">
but it generates
<MY_TAG>
Perhaps I'm doing something wrong?