Popular Posts
Build an OpenVPN server on android device Preparation An android device, in this case, Sony xperia Z is used Root permission required Linux Deploy for deploy i... javax.net.ssl.SSLHandshakeException: Connection closed by peer in Android 5.0 Lollipop Recently, there is a error occurs when access website via ssl connection like below although it worked fine several days ago. // Enable SSL... SwiXml - Layout BorderLayout BorderLayoutPane.xml <?xml version="1.0" encoding="UTF-8"?> <panel layout="BorderLayout...
Blog Archive
Stats
Memorize xml document operation
I have not write codes about operating xml document by C# for months. Almost forget all...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
using Sportingbet.net;
using Sportingbet.util;
using System.Xml.Linq;
using System.Xml.XPath;
using System.Xml;

class Program
{
    static void Main(string[] args)
    {
        string xml = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "tmp.xml");
        XDocument xDoc = XDocument.Parse(xml);
        var nodes = from e in xDoc.XPathSelectElements("//myTag")
                    select e;
        foreach (var e in nodes)
        {
            Console.WriteLine(e);
        }

        XmlDocument xmlDoc = new XmlDocument();
        xmlDoc.LoadXml(xml);
        XmlNodeList nodelist = xmlDoc.SelectNodes("//myTag");
        foreach (XmlNode e in nodelist)
        {
            Console.WriteLine(e.OuterXml);
        }
    }
}