<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env=" http://schemas.xmlsoap.org/soap/envelope/">
<env:Header>
<mm7:TransactionID xmlns:mm7=" http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-6-MM7-1-0" env:mustUnderstand="1">1000011</mm7:TransactionID>
</env:Header>
<env:Body>
<SubmitRsp xmlns=" http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-6-MM7-1-0">
<MM7Version>6.3.0</MM7Version>
<Status>
<StatusCode>1000</StatusCode>
<StatusText>发送成功/StatusText>
</Status>
<MessageID>1234567890</MessageID>
</SubmitRsp>
</env:Body>
</env:Envelope>请问如何才能的xml文档反序列化到对象,另外,这个对象该如何定义啊?
我想得到TransactionID,statuscode,statustext,messageid等数据
<env:Envelope xmlns:env=" http://schemas.xmlsoap.org/soap/envelope/">
<env:Header>
<mm7:TransactionID xmlns:mm7=" http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-6-MM7-1-0" env:mustUnderstand="1">1000011</mm7:TransactionID>
</env:Header>
<env:Body>
<SubmitRsp xmlns=" http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-6-MM7-1-0">
<MM7Version>6.3.0</MM7Version>
<Status>
<StatusCode>1000</StatusCode>
<StatusText>发送成功/StatusText>
</Status>
<MessageID>1234567890</MessageID>
</SubmitRsp>
</env:Body>
</env:Envelope>请问如何才能的xml文档反序列化到对象,另外,这个对象该如何定义啊?
我想得到TransactionID,statuscode,statustext,messageid等数据
using System.Runtime.Serialization.Formatters.Binary; public void Load()
{
try
{
FileStream fs = new FileStream("文件名.xml", FileMode.Open);
BinaryFormatter bf = new BinaryFormatter();
xmldocument a = (xmldocument)bf.Deserialize(fs);
fs.Close();
}
catch (Exception ex)
{
ex.ToString();
}
}
试试这个
动态生成web service