XSD无效:无法将名称xxx解析为(n)'元素声明'组件

时间:2012-07-20 15:25:32

标签: xml xaml xsd xsd-validation

我从我使用XAML 2009序列化的配置文件中生成了以下XSD。但是当我将模式放在Online Validator中时,我得到src-resolve:无法将名称'scg:List'解析为a(n)'元素声明'组件。错误。

    <?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:csu="clr-namespace:ConfigurationUtilityFunctions.Section.User;assembly=ConfigurationUtilityFunctions" xmlns:csw="clr-namespace:ConfigurationUtilityFunctions.Section.WebConfig;assembly=ConfigurationUtilityFunctions" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="clr-namespace:ConfigurationUtilityFunctions;assembly=ConfigurationUtilityFunctions" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:import namespace="clr-namespace:System.Collections.Generic;assembly=mscorlib" />
  <xs:element name="ConfigProfile">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="ConfigProfile.ConfigSections">
          <xs:complexType>
            <xs:sequence>
              <xs:element ref="scg:List" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="ProfileId" type="xs:string" use="required" />
      <xs:attribute name="InstanceName" type="xs:string" use="required" />
      <xs:attribute name="ProfileDesc" type="xs:string" use="required" />
      <xs:attribute name="ProfileName" type="xs:string" use="required" />
      <xs:attribute name="ProfileType" type="xs:string" use="required" />
    </xs:complexType>
  </xs:element>
  <xs:element name="IISSection">
    <xs:complexType>
      <xs:attribute name="AnonymousUser" type="xs:string" use="required" />
      <xs:attribute name="ApplicationPoolName" type="xs:string" use="required" />
      <xs:attribute name="Port" type="xs:unsignedByte" use="required" />
      <xs:attribute name="VirtualDirectoryAlias" type="xs:string" use="required" />
      <xs:attribute name="WebsiteName" type="xs:string" use="required" />
      <xs:attribute name="WebsiteRoot" type="xs:string" use="required" />
    </xs:complexType>
  </xs:element>
</xs:schema>

1 个答案:

答案 0 :(得分:1)

您的XML名称空间scg实际上是指:

clr-namespace:System.Collections.Generic;assembly=mscorlib

我怀疑您的架构验证器是否可以访问mscorlib程序集。