当我运行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”丢失

最佳答案

我添加了xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd",它起作用了。

关于c# - 模式验证警告和错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7126327/

10-11 02:12