我现在正在与 XSD 战斗,这是一种胜利。我试图定义一个类型如下:
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.abc.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType>
<xs:sequence>
<xs:element name="Condition1" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="Operator" minOccurs="1" maxOccurs="1"/>
<xs:element type="xs:string" name="SourceTableValue" minOccurs="1" maxOccurs="1"/>
<xs:element type="xs:string" name="ValueToCompareTo" minOccurs="1" maxOccurs="1"/>
<xs:element type="logicalOperator" name ="AND" minOccurs="0" maxOccurs="unbounded"/>
<xs:element type="logicalOperator" name ="OR" minOccurs="0" maxOccurs="unbounded"/>
<xs:element type="logicalOperator" name ="NOT" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Condition2" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="Operator" minOccurs="1" maxOccurs="1"/>
<xs:element type="xs:string" name="SourceTableValue" minOccurs="1" maxOccurs="1"/>
<xs:element type="xs:string" name="ValueToCompareTo" minOccurs="1" maxOccurs="1"/>
<xs:element type="logicalOperator" name ="AND" minOccurs="0" maxOccurs="unbounded"/>
<xs:element type="logicalOperator" name ="OR" minOccurs="0" maxOccurs="unbounded"/>
<xs:element type="logicalOperator" name ="NOT" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
....
但是,这给了我一个错误,Visual Studio 下划线 xs:element type="logicalOperator"并说“命名空间 '' 不能在此架构中引用”。然后,当我稍后在模式中尝试引用类型“logicalOperator”时,我收到错误“未声明类型逻辑运算符”。我究竟做错了什么?