Ejemplo n.º 1
0
        /// <summary>
        /// Load data dictionary from xmlnode
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public static DataFieldValue loadFromXmlNode(XmlNode node)
        {
            string valu     = node.Attributes["value"].Value;
            string property = "valid";

            if (node.Attributes["property"] != null)
            {
                property = node.Attributes["property"].Value;
            }

            DataFieldValue val = new DataFieldValue(valu, property);

            if (node.Attributes["displayValue"] != null)
            {
                val.displayValue = node.Attributes["displayValue"].Value;
            }


            foreach (XmlNode item in node.ChildNodes)
            {
                if ("extension".Equals(item.Name.ToLowerInvariant()))
                {
                    //
                }
                else
                {
                    throw new NotImplementedException();
                }
            }

            return(val);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Load data dictionary from xmlnode
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public static DataField loadFromXmlNode(XmlNode node)
        {
            string name = node.Attributes["name"].Value;

            if (node.Attributes["optype"] == null)
            {
                throw new PmmlException("Invalid definition: [optype] required in datafield '" + name + "'");
            }
            Optype    optype   = OptypeFromString(node.Attributes["optype"].Value);
            string    dataType = node.Attributes["dataType"].Value;
            DataField field    = new DataField(name, optype, dataType);

            if (node.Attributes["displayName"] != null)
            {
                field.displayName = node.Attributes["displayName"].Value;
            }

            /*tree.ModelName = node.Attributes["modelName"].Value;
             *
             * if (node.Attributes["missingValueStrategy"] != null)
             *      tree.MissingValueStrategy = MissingValueStrategyfromString(node.Attributes["missingValueStrategy"].Value);
             *
             * // By default noTrueChildStrategy = returnNullPrediction
             * tree.noTrueChildStrategy = NoTrueChildStrategy.ReturnNullPrediction;
             * if (node.Attributes["noTrueChildStrategy"] != null)
             *      tree.noTrueChildStrategy = NoTrueChildStrategyfromString(node.Attributes["noTrueChildStrategy"].Value);
             */

            field.fInterval = new List <string>();
            field.fValues   = new List <DataFieldValue>();
            foreach (XmlNode item in node.ChildNodes)
            {
                if ("extension".Equals(item.Name.ToLowerInvariant()))
                {
                    //
                }
                else if ("Interval".Equals(item.Name))
                {
                    field.fInterval.Add(item.InnerText.Trim());
                }
                else if ("Value".Equals(item.Name))
                {
                    field.fValues.Add(DataFieldValue.loadFromXmlNode(item));
                }
                else
                {
                    throw new NotImplementedException();
                }
            }

            return(field);
        }