public bool Parse() { if (null == FileName) { return(false); } bool retValue = true; XmlDocument pReader = new XmlDocument(); pReader.Load(FileName); XmlElement root = pReader.DocumentElement; retValue = rootElement.Parse(root); if (true == retValue) { rootElement.PopulateTreeNode(); } return(retValue); }
virtual public bool Parse(XmlNode node) { bool retValue = true; ElementName = node.Name; if (null != node.FirstChild && XmlNodeType.Text == node.FirstChild.NodeType) { ElementValue = node.InnerText; } else { ElementValue = null; } if (null != node.Attributes) { foreach (XmlAttribute attribute in node.Attributes) { AttributeC attrib = new AttributeC(); attrib.Name = attribute.Name; attrib.Value = attribute.Value; attributes.Add(attrib); } } if (null != node.FirstChild && XmlNodeType.Element == node.FirstChild.NodeType) { foreach (XmlNode childNode in node.ChildNodes) { if (true == retValue) { ElementC child = ElementFactoryC.GetElement(childNode.Name); retValue = child.Parse(childNode); children.Add(child); } } } return(retValue); }