Example #1
0
        static void Main(string[] args)
        {
            RelationshipTable table  = new RelationshipTable();
            TypeElement       parent = new TypeElement();

            parent.FileName = "Test.cs";
            parent.TypeName = "Test";
            parent.Type     = "class";

            TypeElement child = new TypeElement();

            child.FileName = "Test.cs";
            child.TypeName = "Test";
            child.Type     = "class";

            table.add(parent, child);

            Console.WriteLine(table.PackageDependencyXMLRepresentation());
            Console.WriteLine(table.ToXMLString());
        }
Example #2
0
        /* Get Relationship table from the xml string */
        public static RelationshipTable loadFromXML(string xml)
        {
            RelationshipTable table = new RelationshipTable();
            XDocument         doc   = XDocument.Parse(xml);
            XElement          root  = doc.Element("RelationshipInfo");

            foreach (XElement dependency in root.Elements("Dependency"))
            {
                XElement    childElement = dependency.Element("child");
                TypeElement child        = GetTypeElementFromXElement(childElement);

                foreach (XElement relationshipElement in childElement.Elements("Relationship"))
                {
                    XElement    parentElement = relationshipElement.Element("parent");
                    TypeElement parent        = GetTypeElementFromXElement(parentElement);
                    table.add(child, parent);
                }
            }
            return(table);
        }