xml 转实体类,大佬们 ,节点前面带 p0 p1 的怎么转成实体类哇,求助求助 万分感谢,球解答

眼前人天上月 2020-08-12 11:15:55
xml 串 :

<?xml version="1.0"?>

-<p0:deviceCheckInSSBResponse xmlns:p1="http://gsp.bankcomm.com" xmlns:p0="http://chnisbh.service.bankcomm.com/basic/atomic/operation.CHNISBHService/Schema">


-<p1:replyInformation>

<p1:responseType>N</p1:responseType>

<p1:responseCode>SC0000</p1:responseCode>

</p1:replyInformation>


-<p0:response>

<p0:pinKey>ACED164CCB97BD5CCC5B9930DB35A9EC</p0:pinKey>

<p0:pinVerifyNo>6CAEEF</p0:pinVerifyNo>

<p0:macKey>42AD3F4108174615</p0:macKey>

<p0:macVerifyNo>03CA44</p0:macVerifyNo>

</p0:response>

</p0:deviceCheckInSSBResponse>



实体类:
[XmlRoot("deviceCheckInSSBResponse")]
public class BCMOutput
{
[XmlElement(Type = typeof(ResponseHeader))]
public ResponseHeader replyInformation { get; set; }

[XmlElement(Type = typeof(ResponseBody))]
public ResponseBody response { get; set; }

}

[XmlRoot("replyInformation")]
public class ResponseHeader
{
/// <summary>
/// N——成功返回 E——错误信息返回 A——需授权
/// </summary>
public string responseType { get; set; }

/// <summary>
/// 返回信息,BGSP未指定长度
/// </summary>
public string responseCode { get; set; }

/// <summary>
/// 返回信息
/// </summary>
public string responseMessage { get; set; }

public string failMessage
{
get
{
return $"{responseType} | {responseCode} | {responseMessage}";
}
}
}

[XmlRoot("response")]
public class ResponseBody
{

/// <summary>
/// PIN密钥
/// </summary>
public string pinKey { get; set; }

/// <summary>
/// PIN密钥的验证码
/// </summary>
public string pinVerifyNo { get; set; }

/// <summary>
/// 加密的MAC密钥
/// </summary>
public string macKey { get; set; }

/// <summary>
/// MAC密钥的验证码
/// </summary>
public string macVerifyNo { get; set; }

/// <summary>
/// 55域信息
/// </summary>
public string icFld55 { get; set; }

/// <summary>
/// 发卡行授权码
/// </summary>
public string authrIdRes { get; set; }

/// <summary>
/// 系统参考号
/// </summary>
public string refNum { get; set; }

/// <summary>
/// 扩展域
/// </summary>
public string _extFld { get; set; }


[XmlElement(Type = typeof(responseBodyHeader))]
public responseBodyHeader responseHeader { get; set; }
}
...全文
9512 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
goodwell18 2020-08-13
  • 打赏
  • 举报
回复
帮你顶顶帮你顶顶
qq_30412191 2020-08-13
  • 打赏
  • 举报
回复
取到xml的值,然后塞到实体类中
SayoKun 2020-08-13
  • 打赏
  • 举报
回复
复制xml然后VS中编辑-选择性粘贴-粘贴为实体类
  • 打赏
  • 举报
回复
XmlDocument requestDocXml = new XmlDocument(); requestDocXml.LoadXml(requestStr); //字符串 XmlElement rootElement = requestDocXml.DocumentElement; //获取跟节点 XmlNode MsgType = rootElement.SelectSingleNode("MsgType"); //获取节点值 RequestXml requestXml = new RequestXml(); //NEW 类 requestXml.MsgType = MsgType.InnerText; // XML 插入实体类 创建 实体类 public class RequestXml { public string MsgType { get { return m_MsgType; } set { m_MsgType = value; } } }
眼前人天上月 2020-08-12
  • 打赏
  • 举报
回复
大佬们 别沉哈

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧