env.xsd中有:
<xs:complexType name="CT_PaperItem">
    <xs:attribute name="sizeType" type="ST_PaperSizeType" default="1"/>
    <xs:attribute name="paper" type="xs:int" default="297000"/>
</xs:complexType><xs:simpleType name="ST_PaperSizeType">
    <xs:restriction base="xs:int">
      <xs:enumeration value="1" id="FIX"/>
      <xs:enumeration value="2" id="FREE"/>
    </xs:restriction>
  </xs:simpleType>env.xml为:
 <Env sizeType="3" paperV="14000" />----用env.xsd验证env.xml是会出错的,我现在的需求是:当验证出错时,能够自动将sizeType="3"的值变成schema中设置的默认值:1,也就是schema验证出错了的属性的值,用schema中设置的默认值代替,最终生成的XML为:
<Env sizeType="1" paperV="14000" />
上面的需求能简单实现吗?因为我要验证的字段有几百个,用程序一个个判断,再赋默认值不是很现实,不知道c#有没设个属性什么的就能实现的。请高手帮忙啊,谢谢诶