Esempio n. 1
0
        /// <summary>Parses a component profile </summary>
        private AbstractComponent parseComponentProfile(System.Xml.XmlElement elem, bool isSubComponent)
        {
            AbstractComponent comp = null;

            if (isSubComponent)
            {
                comp = new SubComponent();
            }
            else
            {
                comp = new Component();

                int childIndex = 1;
                System.Xml.XmlNodeList children = elem.ChildNodes;
                for (int i = 0; i < children.Count; i++)
                {
                    System.Xml.XmlNode n = children.Item(i);
                    if (System.Convert.ToInt16(n.NodeType) == (short)System.Xml.XmlNodeType.Element)
                    {
                        System.Xml.XmlElement child = (System.Xml.XmlElement)n;
                        if (child.Name.ToUpper().Equals("SubComponent".ToUpper()))
                        {
                            SubComponent subcomp = (SubComponent)parseComponentProfile(child, true);
                            ((Component)comp).setSubComponent(childIndex++, subcomp);
                        }
                    }
                }
            }

            parseAbstractComponentData(comp, elem);

            return(comp);
        }
		/// <summary>Parses a component profile </summary>
		private AbstractComponent parseComponentProfile(System.Xml.XmlElement elem, bool isSubComponent)
		{
			AbstractComponent comp = null;
			if (isSubComponent)
			{
				comp = new SubComponent();
			}
			else
			{
				comp = new Component();
				
				int childIndex = 1;
				System.Xml.XmlNodeList children = elem.ChildNodes;
				for (int i = 0; i < children.Count; i++)
				{
					System.Xml.XmlNode n = children.Item(i);
					if (System.Convert.ToInt16(n.NodeType) == (short) System.Xml.XmlNodeType.Element)
					{
						System.Xml.XmlElement child = (System.Xml.XmlElement) n;
						if (child.Name.ToUpper().Equals("SubComponent".ToUpper()))
						{
							SubComponent subcomp = (SubComponent) parseComponentProfile(child, true);
							((Component) comp).setSubComponent(childIndex++, subcomp);
						}
					}
				}
			}
			
			parseAbstractComponentData(comp, elem);
			
			return comp;
		}