private static void ProcessChild(XElement child, int depth, XamlHeierarchy xamlHeierarchy, bool loadAllElements=false)
        {
            List<string> path = new List<string>();
            XElement higher = child;
            do
            {
                if (higher.HasAttributes)
                {
                    path.Add(higher.FirstAttribute.Value);
                }
                higher = higher.Parent;
            } while (higher != null);
            path.Reverse();
            string stringPath = String.Join(" ",path.ToArray());

            try
            {
                var name = "";
                foreach (XAttribute attribute in child.Attributes())
                {
                    if (attribute.Name.LocalName == "Name")
                        name = attribute.Value;
                }
                if (name == "" && loadAllElements)
                    name = child.Name.LocalName;
                if(name != "")
                    xamlHeierarchy.Root.Add(new StringWrapper(name));
            }
            catch
            {
                Console.WriteLine("Error!");
            }
        }
 private static void ProcessParentOpen(XElement parent, int depth, XamlHeierarchy xamlHeierarchy)
 {
     List<string> path = new List<string>();
     XElement higher = parent;
     do
     {
         if (higher.HasAttributes)
         {
             path.Add(higher.FirstAttribute.Value);
         }
         higher = higher.Parent;
     } while (higher != null);
     path.Reverse();
     foreach (string dir in path)
     {
         Console.Write(dir + " ");
     }
        Console.WriteLine();
 }
 public static void ImportXaml(XDocument file, XamlHeierarchy xamlHeierarchy, bool loadAllElements=false)
 {
     file.Root.RecursivelyProcess(ProcessChild, null, null, xamlHeierarchy, loadAllElements);//ProcessParentClose //ProcessParentOpen
 }