• <bdo id='lFA80'></bdo><ul id='lFA80'></ul>
    <i id='lFA80'><tr id='lFA80'><dt id='lFA80'><q id='lFA80'><span id='lFA80'><b id='lFA80'><form id='lFA80'><ins id='lFA80'></ins><ul id='lFA80'></ul><sub id='lFA80'></sub></form><legend id='lFA80'></legend><bdo id='lFA80'><pre id='lFA80'><center id='lFA80'></center></pre></bdo></b><th id='lFA80'></th></span></q></dt></tr></i><div id='lFA80'><tfoot id='lFA80'></tfoot><dl id='lFA80'><fieldset id='lFA80'></fieldset></dl></div>

      <legend id='lFA80'><style id='lFA80'><dir id='lFA80'><q id='lFA80'></q></dir></style></legend>

      <tfoot id='lFA80'></tfoot>
    1. <small id='lFA80'></small><noframes id='lFA80'>

      1. 如何使 dotnet webservice 设置 minOccurs=“1";在字

        时间:2023-06-04

          <tbody id='3uwNW'></tbody>

            <small id='3uwNW'></small><noframes id='3uwNW'>

            <i id='3uwNW'><tr id='3uwNW'><dt id='3uwNW'><q id='3uwNW'><span id='3uwNW'><b id='3uwNW'><form id='3uwNW'><ins id='3uwNW'></ins><ul id='3uwNW'></ul><sub id='3uwNW'></sub></form><legend id='3uwNW'></legend><bdo id='3uwNW'><pre id='3uwNW'><center id='3uwNW'></center></pre></bdo></b><th id='3uwNW'></th></span></q></dt></tr></i><div id='3uwNW'><tfoot id='3uwNW'></tfoot><dl id='3uwNW'><fieldset id='3uwNW'></fieldset></dl></div>
              <bdo id='3uwNW'></bdo><ul id='3uwNW'></ul>
              <legend id='3uwNW'><style id='3uwNW'><dir id='3uwNW'><q id='3uwNW'></q></dir></style></legend>
              <tfoot id='3uwNW'></tfoot>

                • 本文介绍了如何使 dotnet webservice 设置 minOccurs=“1";在字符串值上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我有一个 XSD:

                  <?xml version="1.0" encoding="UTF-8"?>
                  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
                       xmlns="http://a.com/a.xsd"
                       targetNamespace="http://a.com/a.xsd"
                       elementFormDefault="qualified"
                       attributeFormDefault="unqualified">
                      <xs:element name="A">
                          <xs:complexType>
                              <xs:sequence>
                                  <xs:element name="Item"  minOccurs="1" maxOccurs="1">
                                      <xs:simpleType>
                                          <xs:restriction base="xs:string">
                                              <xs:minLength value="1"/>                                       
                                              <xs:whiteSpace value="collapse"/>
                                          </xs:restriction>
                                      </xs:simpleType>
                                  </xs:element>
                              </xs:sequence>
                          </xs:complexType>
                      </xs:element>
                  </xs:schema>
                  

                  我使用 XSD.exe v2.0.50727.3615 将其转换为 C# 类,生成代码如下

                  Which I have converted into a C# class using XSD.exe v2.0.50727.3615 which generates code as follows

                  namespace A {
                      using System.Xml.Serialization;
                      /// <remarks/>
                      [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
                      [System.SerializableAttribute()]
                      [System.Diagnostics.DebuggerStepThroughAttribute()]
                      [System.ComponentModel.DesignerCategoryAttribute("code")]
                      [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://a.com/a.xsd")]
                      [System.Xml.Serialization.XmlRootAttribute(Namespace="http://a.com/a.xsd", IsNullable=false)]
                      public partial class A {
                          private string itemField;
                          /// <remarks/>
                          public string Item {
                              get {
                                  return this.itemField;
                              }
                              set {
                                  this.itemField = value;
                              }
                          }
                      }
                  }
                  

                  我在我的网络服务中返回了一个 A.A 对象,它在服务描述中生成了这个片段

                  I am returning an A.A object in my webservice, which produces this snippet in the service description

                  <s:schema elementFormDefault="qualified" targetNamespace="http://a.com/a.xsd"> 
                    <s:element name="Test2Result"> 
                      <s:complexType> 
                        <s:sequence> 
                          <s:element minOccurs="0" maxOccurs="1" name="Item" type="s:string" /> 
                        </s:sequence> 
                      </s:complexType> 
                    </s:element> 
                  </s:schema> 
                  

                  从 XSD 中的 minOccrus="1" 到自动生成的 WSDL 中的 minOccurs="0" 的变化正在给系统另一端的机器带来麻烦.

                  The change from minOccrus="1" in the XSD to minOccurs="0" on the auto-generated WSDL is causing grief to the machine on the other end of the system.

                  我当然可以提供手动编辑的 WSDL 供他们使用,但我希望自动生成的 WSDL 能够满足他们的需求.

                  I could of course provide a hand edited WSDL for them to use, but I would like the auto-generated one to suit their needs.

                  关于如何说服 dotnet 在其自动生成的 WSDL 中为字符串类型输出 minOccurs="1" 而不添加 nillable="true" 的任何建议?

                  Any suggestions on how to convince dotnet to output minOccurs="1" for a string type in its autogenerated WSDLs without also adding nillable="true"?

                  推荐答案

                  我注意到下面一行:

                  对于将 XML Schema 复杂类型与非 XML 特定的类绑定,.NET Framework 不提供等效于 minOccurs 或 maxOccurs 属性的直接编程语言.

                  For binding XML Schema complex types with non-XML-specific classes, the .NET Framework does not provide a direct programming language equivalent to the minOccurs or maxOccurs attribute.

                  从这里:http://msdn.microsoft.com/en-us/library/zds0b35c(v=vs.85).aspx

                  这篇关于如何使 dotnet webservice 设置 minOccurs=“1";在字符串值上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:XmlSerialization 和 xsi:SchemaLocation (xsd.exe) 下一篇:允许 XSD 日期元素为空字符串

                  相关文章

                  最新文章

                    <tfoot id='4Ie0n'></tfoot>
                    <legend id='4Ie0n'><style id='4Ie0n'><dir id='4Ie0n'><q id='4Ie0n'></q></dir></style></legend>
                  1. <small id='4Ie0n'></small><noframes id='4Ie0n'>

                        <bdo id='4Ie0n'></bdo><ul id='4Ie0n'></ul>

                    1. <i id='4Ie0n'><tr id='4Ie0n'><dt id='4Ie0n'><q id='4Ie0n'><span id='4Ie0n'><b id='4Ie0n'><form id='4Ie0n'><ins id='4Ie0n'></ins><ul id='4Ie0n'></ul><sub id='4Ie0n'></sub></form><legend id='4Ie0n'></legend><bdo id='4Ie0n'><pre id='4Ie0n'><center id='4Ie0n'></center></pre></bdo></b><th id='4Ie0n'></th></span></q></dt></tr></i><div id='4Ie0n'><tfoot id='4Ie0n'></tfoot><dl id='4Ie0n'><fieldset id='4Ie0n'></fieldset></dl></div>