Exemple #1
0
        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);
        }
Exemple #2
0
 public virtual 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;
 }