如何读取xml的最后一个值 [英] how to read xml's last value

查看:80
本文介绍了如何读取xml的最后一个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个带有值的xml文件:

Hi,
I have an xml file with values :

<?xml version="1.0" encoding="utf-8" ?>
<perls>
    <article name="backgroundworker">
	1
        2
        3
        4
    </article>
   </perls>



我想访问和从vb .net获取最后一个值4,我知道如何打开并写入xml文件。


I want to Access and get the last value 4 from vb .net, I know how to open and write to an xml file.

推荐答案

这里没有最后和非最后的值XML示例。您只有一个文本节点填充数据(如果不计算空格和行尾字符,其中包含1 2 3 4。如果要获得4,可以使用<$ c $分割此值c> string.Split :



The are no last and non-last values in this XML sample. You have only one text node filled with data (if not counting blank spaces and end-of-line characters, which contain "1 2 3 4". If you want to obtain 4", you can split this value using string.Split:

Dim lines As String() = myTextNodeText.Split(
    New Char() {ControlChars.Cr, ControlChars.Lf},
    System.StringSplitOptions.RemoveEmptyEntries)





我不确定这是否是你需要的,只是想给你一个想法。我希望你可以使用一个可用的XML解析器由.NET FCL提供。:-)



-SA


这篇关于如何读取xml的最后一个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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