Popular Posts
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... Close window without confirm (I.E only) window.opener=null; window.open('','_self'); window.close(); focus on validating function focusOnInvalidControl() {     for (var i = 0; i < Page_Validators.length; i++) {         if (!Page_Validators[i].isvalid) {     ...
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);
        }
    }
}