zoukankan      html  css  js  c++  java
  • xml

    using System.Xml.Linq;

    protected static string file = System.Web.HttpContext.Current.Server.MapPath("~/test/ruonanxiao.xml");
            public static string GetName()
            {
                string name = string.Empty;
                XElement doc = XElement.Load(file);
                var names = from p in doc.Descendants("name")
                            select p.Value;
                foreach (var n in names)
                {
                    name = n;
                }
                return name;
            }

            public static string GetSex()
            {
                string name = string.Empty;
                XElement doc = XElement.Load(file);
                var names = from p in doc.Descendants("sex")
                            select p.Value;
                foreach (var n in names)
                {
                    name = n;
                }
                return name;
            }

            public static string GetAge()
            {
                string name = string.Empty;
                XElement doc = XElement.Load(file);
                var names = from p in doc.Descendants("age")
                            select p.Value;
                foreach (var n in names)
                {
                    name = n;
                }
                return name;
            }

  • 相关阅读:
    careercup-高等难度 18.1
    面试——网络
    堆和栈的区别(转过无数次的文章)
    Linux用户空间与内核空间(理解高端内存)
    Linux内存管理
    位操作实现加减乘除四则运算
    栈的压入和弹出序列
    DG gap sequence修复一例
    ORACLE 11gR2 DG(Physical Standby)日常维护02
    oracle的特殊权限s bit丢失
  • 原文地址:https://www.cnblogs.com/ruonanxiao/p/2439789.html
Copyright © 2011-2022 走看看