Ejemplo n.º 1
0
        public static List <ParameterDetails> GetParametersFromXml(XmlNode node, Classifier objectTypes)
        {
            List <ParameterDetails> templist = new List <ParameterDetails>();

            try
            {
                foreach (XmlNode param in node.ChildNodes)
                {
                    if (param.Attributes[Schema.type].Value != Schema.container_name)
                    {
                        int minOccurs = int.Parse(param.Attributes[Schema.minOccurs]?.Value);
                        int maxOccurs = param.Attributes[Schema.maxOccurs]?.Value == "" ? 9999 : int.Parse(param.Attributes[Schema.maxOccurs]?.Value);
                        if (objectTypes == Classifier.Optional && maxOccurs >= 1 && !(minOccurs == 1 && maxOccurs == 1))
                        {
                            templist.Add(ParameterDetails.LoadFromXml(param));
                        }
                        else if (objectTypes == Classifier.Required && minOccurs >= 1 && maxOccurs >= 1)
                        {
                            templist.Add(ParameterDetails.LoadFromXml(param));
                        }
                        else
                        {
                            templist.Add(ParameterDetails.LoadFromXml(param));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception("Error reading Scheme : " + e.Message + "\n" + node.InnerXml);
            }
            return(templist);
        }
Ejemplo n.º 2
0
        public static List <ParameterDetails> GetParametersFromXml(XmlNode node, Classifier objectTypes)
        {
            List <ParameterDetails> templist = new List <ParameterDetails>();

            try
            {
                foreach (XmlNode param in node.ChildNodes)
                {
                    if (param.Name != "#comment" && (string)Getvalue(param, Value.Type) != Schema.container_name)
                    {
                        int minOccurs = (int)Getvalue(node, Value.minOccurs);
                        int maxOccurs = (int)Getvalue(node, Value.maxOccurs);
                        if (objectTypes == Classifier.Optional && maxOccurs >= 1 && !(minOccurs == 1 && maxOccurs == 1))
                        {
                            templist.Add(ParameterDetails.LoadFromXml(param));
                        }
                        else if (objectTypes == Classifier.Required && minOccurs >= 1 && maxOccurs >= 1)
                        {
                            templist.Add(ParameterDetails.LoadFromXml(param));
                        }
                        else
                        {
                            templist.Add(ParameterDetails.LoadFromXml(param));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception("Error reading Scheme : " + e.Message + "\n" + node.InnerXml);
            }
            return(templist);
        }