using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using Microsoft.SqlServer.Management.Smo;
namespace XPathExp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Server server = new Server();
            XPathExpression xp = server.Urn.XPathExpression;
            Database d = server.Databases["Scratch"];
            Console.WriteLine(
            server.Urn.XPathExpression[server.Urn.XPathExpression.Length-1]);
            xp = server.Databases[0].Urn.XPathExpression;
            Console.WriteLine(d.Urn.Value);
            Table t = d.Tables[0];
            xp = t.Urn.XPathExpression;
            XPathExpressionBlock b = xp[2];
            String s = b.ToString();
            s = b.Filter.ToString();
            s = b.Name;
           
            foreach (DictionaryEntry de in b.FixedProperties)
            {
                Console.WriteLine(de.Key + " " + de.Value);
            }
            String[] steps = t.Urn.Value.Split('/');
            foreach (String s1 in steps)
            {
                Console.WriteLine(s1);
            }
            foreach (Table t1 in d.Tables)
            {
                Console.WriteLine(t1.Urn.Value);
            }
            Table t5 = (Table)server.GetSmoObject(
"Server[@Name='CANOPUS5']/Database[@Name='Scratch']/Table[@Name='test[00]/p' and @Schema='dbo']");

        }
    }
}
