久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

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

      • <bdo id='Cm0QP'></bdo><ul id='Cm0QP'></ul>
      <legend id='Cm0QP'><style id='Cm0QP'><dir id='Cm0QP'><q id='Cm0QP'></q></dir></style></legend>

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

        在 .NET XML 反序列化中,如何允許多態(tài)使用 Array

        In .NET XML deserialization, how can I allow polymorphic use of Array types?(在 .NET XML 反序列化中,如何允許多態(tài)使用 Array 類型?)

        1. <tfoot id='JQmQS'></tfoot>
          <legend id='JQmQS'><style id='JQmQS'><dir id='JQmQS'><q id='JQmQS'></q></dir></style></legend>
            <tbody id='JQmQS'></tbody>

        2. <small id='JQmQS'></small><noframes id='JQmQS'>

              <bdo id='JQmQS'></bdo><ul id='JQmQS'></ul>

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

                • 本文介紹了在 .NET XML 反序列化中,如何允許多態(tài)使用 Array 類型?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時(shí)送ChatGPT賬號(hào)..

                  示例架構(gòu):

                  <complexType name="Dog">...</complexType>
                  <complexType name="Cat">...</complexType>
                  
                  <complexType name="ArrayOfDog">
                      <sequence>
                          <element name="Dog" type="tns:Dog minOccurs="0" maxOccurs="unbounded" />
                      </sequence>
                  </complexType>
                  
                  <complexType name="Foo">
                      <sequence>
                          <element name="Bar" type="string"/>          
                          <element name="Baz" type="anyType"/>
                      </sequence>
                  </complexType>
                  

                  通過 .NET 的 wsdl.exe 運(yùn)行它會(huì)生成類似于以下的代碼:

                  Running this through .NET's wsdl.exe generates code similar to the following:

                  [System.Xml.Serialization.XmlIncludeAttribute(typeof(Dog[]))]
                  
                  public partial class Dog { ... }
                  
                  public partial class Cat { ... }
                  
                  public partial class Foo {
                      private string barField;
                      private object bazField;
                  }
                  

                  似乎 wsdl.exe 試圖變得聰明",并意識(shí)到我的 ArrayOfDog 實(shí)際上只是一個(gè)可以編碼為 C# 數(shù)組的包裝器類型.當(dāng)在另一種數(shù)據(jù)類型中顯式引用 ArrayOfDog 時(shí),這可以正常工作.但是,當(dāng)多態(tài)使用 ArrayOfDog(例如,作為 xsd:anyType 的替代)時(shí),這會(huì)中斷.它似乎崩潰了,因?yàn)?.NET 運(yùn)行時(shí)對(duì)名為ArrayOfDog"的 complexType 一無所知——它基本上已經(jīng)拋棄了這些信息,而只支持使用本機(jī) C# 數(shù)組.

                  It appears that wsdl.exe is trying to be "smart" and realize that my ArrayOfDog is really just a wrapper type that can be encoded as a C# array. This works fine when ArrayOfDog is explicitly referenced in another data type. However, when ArrayOfDog is used polymorphically (e.g. as a substitution for xsd:anyType) this breaks. It appears to break because the .NET runtime knows nothing about the complexType named "ArrayOfDog" - it has basically thrown away this information in favor of just using native C# arrays.

                  示例 XML 文檔 1:

                  Example XML document 1:

                  <Foo>
                      <Bar>Hello</Bar>
                      <Baz xsi:type="Cat">
                          ...
                      </Baz>
                  </Foo>
                  

                  示例 XML 文檔 2:

                  Example XML document 2:

                  <Foo>
                      <Bar>Hello</Bar>
                      <Baz xsi:type="ArrayOfDog">
                          <Dog>...</Dog>
                          <Dog>...</Dog>
                      </Baz>
                  </Foo>
                  

                  文檔#1 被運(yùn)行時(shí)正確反序列化.我得到了一個(gè) Foo 類型的對(duì)象,其中包含 Bar 和 Baz 的正確反序列化字段.

                  Document #1 is deserialized correctly by the runtime. I get an object of type Foo with correctly deserialized fields for Bar and Baz.

                  文檔 #2 被運(yùn)行時(shí)錯(cuò)誤地反序列化.我得到了一個(gè) Foo 類型的對(duì)象,它具有正確反序列化的 Bar 字段,但對(duì)于 Baz 字段,我得到 System.XML.XMLNode[].我的猜測(cè)是因?yàn)檫\(yùn)行時(shí)對(duì)名為ArrayOfDog"的實(shí)體的任何類型綁定一無所知.您可能認(rèn)為 XmlInclude 指令XmlIncludeAttribute(typeof(Dog[]))"可以處理這個(gè)問題,但它似乎不起作用.

                  Document #2 is deserialized incorrectly by the runtime. I get an object of type Foo with a correctly deserialized field for Bar, but for the Baz field I get System.XML.XMLNode[]. My guess is because the runtime knows nothing about any type binding for an entity named "ArrayOfDog". You might think that the XmlInclude directive "XmlIncludeAttribute(typeof(Dog[]))" would handle this, but it doesn't appear to be working.

                  有人遇到過這個(gè)嗎?

                  這里有一個(gè)優(yōu)雅的解決方案嗎?我正在考慮使用的解決方法是將我的ArrayOf"類型包裝在另一種類型中,并將其包含在 xsd:anyType 的替換中.

                  Is there an elegant solution here? The workaround I'm thinking of using is to wrap my "ArrayOf" type in another type and include that in the subsitution for the xsd:anyType.

                  推薦答案

                  我認(rèn)為這與多態(tài)無關(guān).我認(rèn)為這是 XML 序列化程序中的一個(gè)錯(cuò)誤,假設(shè)任何名為ArrayOfDog"的類型,包含Dog"序列意味著代表一個(gè) Dog[].作為對(duì)這一理論的測(cè)試,嘗試將 WSDL 更改為使用名稱BunchOfDogs",并查看這是否會(huì)更改客戶端中的代理代碼.

                  I don't think this has anything to do with polymorphism. I think this is a bug in the XML Serializer, assuming that any type named "ArrayOfDog", containing a sequence of "Dog" is meant to represent a Dog[]. As a test of this theory, try changing the WSDL to use the name "BunchOfDogs" instead, and see if this changes the proxy code in the client.

                  如果您想要 XML 中的多態(tài)性,那么 ArrayOfDog 和 Cat 都需要是相同基本類型的擴(kuò)展(xsd:any 除外).如果是這種情況,那么我希望 .NET 將 Baz 生成為基本類型.

                  If you want polymorphism in XML, then both ArrayOfDog, and Cat, will need to be extensions of the same base type (other than xsd:any). If that were the case, then I'd expect .NET to generate Baz as being of the base type.

                  帶有 xsd:any 的架構(gòu)通常會(huì)導(dǎo)致問題.里面幾乎可以有任何東西,有些組合根本沒有意義.

                  Schemas with xsd:any cause problems just in general. There could be almost anything in there, and some combinations will simply not make sense.

                  您還沒有說這個(gè) Java 服務(wù)是否來自 Axis,或者它是什么版本.我已經(jīng)看到 Axis 表現(xiàn)得好像 xsi:type 是有效模式的替代品.小心需要正確"使用 xsi:type 的模式.

                  You haven't said if this Java service is from Axis, or what version it is. I've seen Axis behave as though xsi:type were a substitute for a valid schema. Be careful with schemas that require "proper" use of xsi:type.

                  這篇關(guān)于在 .NET XML 反序列化中,如何允許多態(tài)使用 Array 類型?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  What are good algorithms for vehicle license plate detection?(車牌檢測(cè)有哪些好的算法?)
                  onClick event for Image in Unity(Unity中圖像的onClick事件)
                  Running Total C#(運(yùn)行總 C#)
                  Deleting a directory when clicked on a hyperlink with JAvascript.ASP.NET C#(單擊帶有 JAvascript.ASP.NET C# 的超鏈接時(shí)刪除目錄)
                  asp.net listview highlight row on click(asp.net listview 在單擊時(shí)突出顯示行)
                  Calling A Button OnClick from a function(從函數(shù)調(diào)用按鈕 OnClick)

                    <tbody id='xFwoB'></tbody>
                    <bdo id='xFwoB'></bdo><ul id='xFwoB'></ul>
                  • <tfoot id='xFwoB'></tfoot>

                        <small id='xFwoB'></small><noframes id='xFwoB'>

                      • <legend id='xFwoB'><style id='xFwoB'><dir id='xFwoB'><q id='xFwoB'></q></dir></style></legend>

                          <i id='xFwoB'><tr id='xFwoB'><dt id='xFwoB'><q id='xFwoB'><span id='xFwoB'><b id='xFwoB'><form id='xFwoB'><ins id='xFwoB'></ins><ul id='xFwoB'></ul><sub id='xFwoB'></sub></form><legend id='xFwoB'></legend><bdo id='xFwoB'><pre id='xFwoB'><center id='xFwoB'></center></pre></bdo></b><th id='xFwoB'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='xFwoB'><tfoot id='xFwoB'></tfoot><dl id='xFwoB'><fieldset id='xFwoB'></fieldset></dl></div>
                          1. 主站蜘蛛池模板: 国产欧美日韩综合精品一区二区 | 日韩av资源站 | 99久久精品国产一区二区三区 | 天堂资源最新在线 | 午夜视频在线免费观看 | 欧美www在线 | 欧美不卡视频一区发布 | a级性视频| 欧美日韩一卡 | 国产亚洲精品美女久久久久久久久久 | 毛片网站在线观看视频 | 一级片在线观看视频 | 毛片黄片免费看 | av黄色在线播放 | 四虎影院新网址 | 日本三级在线网站 | 一区二区中文字幕 | 成人欧美一区二区三区在线观看 | 国产成人jvid在线播放 | 久久久综合网 | 国内精品在线视频 | 日本黄视频在线观看 | 免费特黄视频 | 国产乱码精品一区二区三区忘忧草 | 日韩欧美在线视频 | 日韩视频在线观看一区二区 | 中文字幕精品一区久久久久 | 中文字幕免费观看 | 国产一区久久 | 国产精品视频久久久 | 天天色综网 | 国产片淫级awww | 三区四区在线观看 | 色网在线播放 | 国产精品夜夜春夜夜爽久久电影 | 蜜月aⅴ国产精品 | 亚洲国产精品99久久久久久久久 | 久久激情视频 | 久久精品国产一区 | 成人av片在线观看 | 久久国产成人 |