求救 .net 2003 下面这个schema通过校验,但为什么2005下不行呢?

tolily tolily 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema elementFormDefault="unqualified" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Configuration">
<xs:complexType>
<xs:sequence>
<xs:element name="a" minOccurs="1" maxOccurs="unbounded">
<xs:element name="state" minOccurs="1" maxOccurs="unbounded">
<xs:any maxOccurs="unbounded" minOccurs="0" processContents="skip" />
</xs:sequence>
</xs:complexType>
</xs:element>

报错,说state跟any会造成歧义,但是在2003里面验证正常,验证代码都是一样的,如下:

private void ValidateSchema( XmlNode section )
{
XmlValidatingReader validatingReader = null;
Stream xsdFile = null;
StreamReader streamReader = null;
try
{
//Validate the document using a schema
validatingReader = new XmlValidatingReader( new XmlTextReader( new StringReader( section.OuterXml ) ) );
validatingReader.ValidationType = ValidationType.Schema;

xsdFile = Resource.ResourceManager.GetStream( "UIPConfigSchema.xsd" );
streamReader = new StreamReader( xsdFile );


XmlTextReader reader = new XmlTextReader(streamReader);
XmlSchema schema = XmlSchema.Read(reader,null);
validatingReader.Schemas.Add( schema );
validatingReader.ValidationEventHandler += new ValidationEventHandler(ValidationCallBack);

// Validate the document
while (validatingReader.Read()){}

}


...全文

相关推荐

评论
收藏 已收藏
分享
返回顶部
tolily
.NET技术其他语言 1,979 成员 12,447 内容