コード例 #1
0
ファイル: SequenceInfoNode.cs プロジェクト: avgx/knigoskop
        public override void Load(XmlElement parentNode)
        {
            if (parentNode == null)
            {
                throw new ArgumentNullException("parentNode");
            }

            this.name   = null;
            this.number = null;

            XmlAttribute nameAttr = parentNode.Attributes["name"];

            if (nameAttr != null)
            {
                if (!String.IsNullOrEmpty(nameAttr.Value))
                {
                    this.name = nameAttr.Value;
                }
            }

            XmlAttribute numberAttr = parentNode.Attributes["number"];

            if (numberAttr != null)
            {
                if (!String.IsNullOrEmpty(numberAttr.Value))
                {
                    try
                    {
                        this.number = Int32.Parse(numberAttr.Value, CultureInfo.InvariantCulture);
                    }
                    catch (FormatException)
                    {
                    }
                }
            }

            children.Clear();

            XmlNodeList nodes = parentNode.SelectNodes("./sequence");

            if (nodes != null)
            {
                foreach (XmlElement element in nodes)
                {
                    SequenceInfoNode child = new SequenceInfoNode();
                    child.Load(element);

                    children.Add(child);
                }
            }
        }
コード例 #2
0
ファイル: SequenceInfoNode.cs プロジェクト: avgx/knigoskop
        public override void Load(XmlElement parentNode)
        {
            if (parentNode == null)
            {
                throw new ArgumentNullException("parentNode");
            }

            this.name = null;
            this.number = null;

            XmlAttribute nameAttr = parentNode.Attributes["name"];
            if(nameAttr != null)
            {
                if(!String.IsNullOrEmpty(nameAttr.Value))
                {
                    this.name = nameAttr.Value;
                }
            }

            XmlAttribute numberAttr = parentNode.Attributes["number"];
            if(numberAttr != null)
            {
                if(!String.IsNullOrEmpty(numberAttr.Value))
                {
                    try
                    {
                        this.number = Int32.Parse(numberAttr.Value, CultureInfo.InvariantCulture);
                    }
                    catch (FormatException)
                    {
                    }
                }
            }

            children.Clear();

            XmlNodeList nodes = parentNode.SelectNodes("./sequence");
            if(nodes != null)
            {
                foreach (XmlElement element in nodes)
                {
                    SequenceInfoNode child = new SequenceInfoNode();
                    child.Load(element);

                    children.Add(child);
                }
            }
        }