删除XSI属性并指定类属性 [英] Remove XSI attribute and specify class properties instead

查看:70
本文介绍了删除XSI属性并指定类属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很擅长XML序列化,这可能并不复杂,但到目前为止我尝试了对课程的一些修改无济于事。我需要生成一个类似于此的SOAP消息(为简洁起见,此处仅包含相关部分)。

Hi,

I'm not well versed into XML serialization, this may not be complicated, but so far I tried some changes to the class to no avail. I need to generate a SOAP message looking like this (only relevant sections are included here for brevity sake).

     <soap:Body>
        …
        <Permit>
          <PermitLicenceID>integer</PermitLicenceID>
          …
          <AssociatedIndustries>
             <NAICS>
                <Code>string</Code>
                <ContactUs>string</ContactUs>
	     </NAICS>
             <NAICS>
                <Code>string</Code>
                <ContactUs>string</ContactUs>
	     </NAICS>
          </AssociatedIndustries>
        </Permit>
     </soap:Body>




相反,我得到这样的东西..



instead i get something like this..

     <soap:Body>
        …
        <Permit>
          <PermitLicenceID>integer</PermitLicenceID>
          …
          <AssociatedIndustries>
            <NAICS xsi:nil="true" />
            <NAICS xsi:nil="true" />
          </AssociatedIndustries>
        </Permit>
     </soap:Body>




我的问题很简单,如果使用Code和ContactUs作为公共属性创建类NAICS,为什么它会像这样序列化?如何创建我的类,而不是隐藏NAICS类的细节,这些属性显示在Soap消息中(并且xsi消失)?



My question is simple, if the class NAICS has been created with Code and ContactUs as public properties, why is it serializing like this? how do I create my classes so instead of hiding details of the NAICS class, those properties are displayed in the Soap message (and the xsi goes away)?

推荐答案

它看起来你还没有填充你的NAICS实例。请显示用于生成此输出的代码。
It looks like you haven't populated your NAICS instances. Please show the code used to produce this output.


这篇关于删除XSI属性并指定类属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆