当前位置: 代码迷 >> Web Service >> 求回到xml格式的代码
  详细解决方案

求回到xml格式的代码

热度:193   发布时间:2012-12-22 12:05:06.0
求返回xml格式的代码
终端用GetRule(string strmeid)这个接口,这个接口以xml的形式返回所需要的数据

<Table diffgr:id="Table1" msdata:rowOrder="0">
  <ID>661</ID> 
  <IP>202.96.172.232</IP> 
  <PORT>10041</PORT> 
</Table>


我是新手,求打样儿代码
------最佳解决方案--------------------
GetRule返回string就行了, GetRule内部你组织成xml格式的字符串,接收方直接用xmldocument读取就行了
------其他解决方案--------------------
楼主是什么意思啊?都没怎么看懂啊
贴个代码 给你看看吧
public XElement GetRule(string strmeid)
        {
                XElement x=XElement.Parse(" <Table diffgr:id=\"Table1\" msdata:rowOrder=\"0\">"   
                                            +"<ID>661</ID>"    
                                            +"<IP>202.96.172.232</IP>"    
                                            +"<PORT>10041</PORT>"  
                                            +"</Table>");

                return x;
        }
------其他解决方案--------------------
求内部代码

        [WebMethod]
        public string GetRule(string strmeid)
        {
            return "table表";
        }

------其他解决方案--------------------

没什么内部代码。任何的json和XML数据都是已长文本交互的
数据格式只是在加载和解析的时候有不同的地方而已。

 
------其他解决方案--------------------
里面的数据我要写死,要返回的就是这种格式的东西,有没有代码?我是新手,谢谢

<Table diffgr:id="Table1" msdata:rowOrder="0">   
<ID>661</ID>    
<IP>202.96.172.232</IP>    
<PORT>10041</PORT>  
</Table>

------其他解决方案--------------------
引用:
楼主是什么意思啊?都没怎么看懂啊
贴个代码 给你看看吧
public XElement GetRule(string strmeid)
        {
                XElement x=XElement.Parse(" <Table diffgr:id=\"Table1\" msdata:rowOrder=\"0\">"   
  相关解决方案