架构验证警告和错误

时间:2011-08-19 19:16:49

标签: c# xsd

当我运行xsd工具生成vb类时:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="Security" type="SecurityType"/>
<xs:complexType name="SecurityType">
   <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="1" name="UsernameToken" type="UsernameToken"/>
    </xs:sequence> 
    <xs:attribute name="mustUnderstand" type="xs:string"/>
    <xs:anyAttribute/>
</xs:complexType>
<xs:complexType name="UsernameToken">
    <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="1" name="Username" type="xs:string"/>
        <xs:element minOccurs="0" maxOccurs="1" name="Password" type="Password"/>
    </xs:sequence>
    <xs:attribute name="Id" type="xs:string"/>
</xs:complexType>
<xs:complexType name="Password">
    <xs:simpleContent>
        <xs:extension base="xs:string">
            <xs:attribute name="Type" type="xs:string"/>
        </xs:extension>
    </xs:simpleContent>
</xs:complexType>
</xs:schema>

我收到以下架构验证警告:

未声明类型密码
类型UsernameToken未声明为
类型SecurityType未声明

我收到以下错误:

缺少数据类型'SecurityType'

1 个答案:

答案 0 :(得分:3)

我添加了xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"并且它有效。