.net – 如何解决“无法找到元素/属性的模式信息”?

前端之家收集整理的这篇文章主要介绍了.net – 如何解决“无法找到元素/属性的模式信息”?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在visual studio中,我有一个使用MS Enterprise Library 4.0应用程序块的asp.net 3.5项目。

当我的Web配置文件打开,我的错误列表填充了99消息与类似

Could not find schema information for the element 'dataConfiguration'.  
Could not find schema information for the attribute 'defaultDatabase'.  
Could not find schema information for the element 'loggingConfiguration'.   
Could not find schema information for the attribute 'tracingEnabled'.   
Could not find schema information for the attribute 'defaultCategory'.

如果我关闭Web.config文件,他们就会离开(但是,一旦我需要再次打开文件,它们会回来)。

在做了一些查找之后,我发现这是becauase有一个XSD或模式文件缺少Visual Studio需要为了正确地“理解”在web.config文件中的模式,并提供intellisense它。

有谁知道如何提供VS与适当的模式信息,或关闭这些消息?

@Franci – 感谢信息,我已经尝试过那个工具以及MMC管理单元(他们往往会炸毁Web.config中的格式化),但他们仍然不解决我收到的刺激性警告。感谢尝试。

我使用EntLib配置的工具配置了app.config,并设置了我的LoggingConfiguration块。然后我把这个复制到DotNetConfig.xsd。当然,它不包括所有的属性,只有我添加的,但它不再显示那些恼人的信息消息。
<xs:element name="loggingConfiguration">
      <xs:complexType>
        <xs:sequence>
          <xs:element name="listeners">
            <xs:complexType>
              <xs:sequence>
                <xs:element maxOccurs="unbounded" name="add">
                  <xs:complexType>
                    <xs:attribute name="fileName" type="xs:string" use="required" />
                    <xs:attribute name="footer" type="xs:string" use="required" />
                    <xs:attribute name="formatter" type="xs:string" use="required" />
                    <xs:attribute name="header" type="xs:string" use="required" />
                    <xs:attribute name="rollFileExistsBehavior" type="xs:string" use="required" />
                    <xs:attribute name="rollInterval" type="xs:string" use="required" />
                    <xs:attribute name="rollSizeKB" type="xs:unsignedByte" use="required" />
                    <xs:attribute name="timeStampPattern" type="xs:string" use="required" />
                    <xs:attribute name="listenerDataType" type="xs:string" use="required" />
                    <xs:attribute name="traceOutputOptions" type="xs:string" use="required" />
                    <xs:attribute name="filter" type="xs:string" use="required" />
                    <xs:attribute name="type" type="xs:string" use="required" />
                    <xs:attribute name="name" type="xs:string" use="required" />
                  </xs:complexType>
                </xs:element>
              </xs:sequence>
            </xs:complexType>
          </xs:element>
          <xs:element name="formatters">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="add">
                  <xs:complexType>
                    <xs:attribute name="template" type="xs:string" use="required" />
                    <xs:attribute name="type" type="xs:string" use="required" />
                    <xs:attribute name="name" type="xs:string" use="required" />
                  </xs:complexType>
                </xs:element>
              </xs:sequence>
            </xs:complexType>
          </xs:element>
          <xs:element name="logFilters">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="add">
                  <xs:complexType>
                    <xs:attribute name="enabled" type="xs:boolean" use="required" />
                    <xs:attribute name="type" type="xs:string" use="required" />
                    <xs:attribute name="name" type="xs:string" use="required" />
                  </xs:complexType>
                </xs:element>
              </xs:sequence>
            </xs:complexType>
          </xs:element>
          <xs:element name="categorySources">
            <xs:complexType>
              <xs:sequence>
                <xs:element maxOccurs="unbounded" name="add">
                  <xs:complexType>
                    <xs:sequence>
                      <xs:element name="listeners">
                        <xs:complexType>
                          <xs:sequence>
                            <xs:element name="add">
                              <xs:complexType>
                                <xs:attribute name="name" type="xs:string" use="required" />
                              </xs:complexType>
                            </xs:element>
                          </xs:sequence>
                        </xs:complexType>
                      </xs:element>
                    </xs:sequence>
                    <xs:attribute name="switchValue" type="xs:string" use="required" />
                    <xs:attribute name="name" type="xs:string" use="required" />
                  </xs:complexType>
                </xs:element>
              </xs:sequence>
            </xs:complexType>
          </xs:element>
          <xs:element name="specialSources">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="allEvents">
                  <xs:complexType>
                    <xs:attribute name="switchValue" type="xs:string" use="required" />
                    <xs:attribute name="name" type="xs:string" use="required" />
                  </xs:complexType>
                </xs:element>
                <xs:element name="notProcessed">
                  <xs:complexType>
                    <xs:attribute name="switchValue" type="xs:string" use="required" />
                    <xs:attribute name="name" type="xs:string" use="required" />
                  </xs:complexType>
                </xs:element>
                <xs:element name="errors">
                  <xs:complexType>
                    <xs:sequence>
                      <xs:element name="listeners">
                        <xs:complexType>
                          <xs:sequence>
                            <xs:element name="add">
                              <xs:complexType>
                                <xs:attribute name="name" type="xs:string" use="required" />
                              </xs:complexType>
                            </xs:element>
                          </xs:sequence>
                        </xs:complexType>
                      </xs:element>
                    </xs:sequence>
                    <xs:attribute name="switchValue" type="xs:string" use="required" />
                    <xs:attribute name="name" type="xs:string" use="required" />
                  </xs:complexType>
                </xs:element>
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:sequence>
        <xs:attribute name="name" type="xs:string" use="required" />
        <xs:attribute name="tracingEnabled" type="xs:boolean" use="required" />
        <xs:attribute name="defaultCategory" type="xs:string" use="required" />
        <xs:attribute name="logWarningsWhenNoCategoriesMatch" type="xs:boolean" use="required" />
      </xs:complexType>
    </xs:element>
原文链接:https://www.f2er.com/xml/293909.html

猜你在找的XML相关文章