从Web Service获取XML值 [英] Get XML values from Web Service

查看:62
本文介绍了从Web Service获取XML值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我是asp.net网络服务的新手。



我创建了一个Web服务。



在我的service.asmx文件中,我添加了以下代码



Hi,

I am new to asp.net web services.

I have created a web service.

In my service.asmx file I have added the below code

string[,] ascii = 
    { 
    {"1","42","0001"},
    {"2","43","0010"},
    {"5","46","0101"}                       
    };

[WebMethod]
    public string GetBinaryValue(string num)
    {
        for (int i = 0; i < ascii.GetLength(0); i++)
        {
            if (String.Compare(num, ascii[i, 0], true) == 0)
                return ascii[i, 2].ToString();
        }
        return "Value Not Found";
    }





当我提供任何现有价值时,它会生成一个XML文件。



就像是





When I give any existing value, it will generate an XML file.

It will be like

<string>0101</string>





现在我想在我的代码中获得整个xml结构。



请帮忙。



提前致谢



Now I want to get the whole xml structure in my code behind.

Please help.

Thanks in advance

推荐答案

查看这些链接



如何:使用XmlReader解析XML [ ^ ]



使用C#轻松解析XML [ ^ ]



用C#解析XML的5种方法 [ ^ ]



在C#代码中解析(大)XML的最佳方法是什么? [ ^ ]



问候..
See these links

How to: Parse XML with XmlReader[^]

Easy XML Parsing in C#[^]

5 Ways to Parse XML in C#[^]

What is the best way to parse (big) XML in C# Code?[^]

Regards..


这篇关于从Web Service获取XML值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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