GuiCompare.XMLAssembly.LoadData C# (CSharp) Method

LoadData() public method

public LoadData ( XmlNode node ) : void
node System.Xml.XmlNode
return void
		public override void LoadData (XmlNode node)
		{
			if (node == null)
				throw new ArgumentNullException ("node");

			name = node.Attributes ["name"].Value;
			version = node.Attributes  ["version"].Value;
			XmlNode atts = node.FirstChild;
			attributes = new XMLAttributes ();
			if (atts.Name == "attributes") {
				attributes.LoadData (atts);
				atts = atts.NextSibling;
			}

			if (atts == null || atts.Name != "namespaces") {
				Console.Error.WriteLine ("Warning: no namespaces found!");
				return;
			}

			namespaces = (XMLNamespace []) LoadRecursive (atts.ChildNodes, typeof (XMLNamespace));
		}

Usage Example

Example #1
0
        public static XMLAssembly CreateFromFile(string file)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(File.OpenRead(file));

            XmlNode node = doc.SelectSingleNode("/assemblies/assembly");

            if (node != null)
            {
                XMLAssembly result = new XMLAssembly();
                try
                {
                    result.LoadData(node);
                }
                catch (Exception e)
                {
                    Console.Error.WriteLine("Error loading {0}: {1}\n{2}", file, e.Message, e);
                    return(null);
                }
                return(result);
            }

            return(null);
        }
All Usage Examples Of GuiCompare.XMLAssembly::LoadData