private XmlAttribute PrepareDefaultAttribute(SchemaAttDef attdef, string attrPrefix, string attrLocalname, string attrNamespaceURI)
{
SetDefaultNamespace(attrPrefix, attrLocalname, ref attrNamespaceURI);
XmlAttribute defattr = CreateDefaultAttribute(attrPrefix, attrLocalname, attrNamespaceURI);
//parsing the default value for the default attribute
defattr.InnerXml = attdef.DefaultValueRaw;
//during the expansion of the tree, the flag could be set to true, we need to set it back.
XmlUnspecifiedAttribute unspAttr = defattr as XmlUnspecifiedAttribute;
if (unspAttr != null)
{
unspAttr.SetSpecified(false);
}
return defattr;
}