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

tolily 2006-01-19 02:06:03
<?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()){}

}


...全文
77 回复 打赏 收藏 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

1,979

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 其他语言讨论
社区管理员
  • 其他语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧