首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web Service >

求回到xml格式的代码

2012-12-22 
求返回xml格式的代码终端用GetRule(string strmeid)这个接口,这个接口以xml的形式返回所需要的数据Table

求返回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">"   


                  ……





System.InvalidOperationException: 在架构的顶级不能使用通配符。
有错误。

热点排行