protected void parseNode(XmlNode n, System.Xml.XmlReader reader) { if (n.Attributes["key"] == null) { throw new ConfigurationErrorsException("Missing [\"key\"] attribute!", reader); } else { Key = n.Attributes["key"].Value; } //here decide what to do , there can by Map so make children if (n.Attributes["value"] != null) { Value = n.Attributes["value"].Value; } else { if (n.HasChildNodes) { Boolean isFirst = true; KeyValueMap pc = new KeyValueMap(); Boolean cdata = false; foreach (XmlNode c in n.ChildNodes) { if (c.NodeType == XmlNodeType.Element) { isFirst = false; //after first regular node we set first on false KeyValuePair kp = new KeyValuePair(c, reader); pc[kp.Key] = kp; }else if(isFirst && (c.NodeType == XmlNodeType.Text || c.NodeType == XmlNodeType.CDATA)){ Value = c.Value; cdata = true; break; //we have value so break for } } if (!cdata) Value = pc; } else { throw new Exception("Config value with key = \"" + Key + "\" has no value!"); } } }
public HxXWDatabaseRecord(Session session, KeyValuePair aParams, Boolean clone) : this(session, aParams.Key, aParams.AsString, clone) { }
public void Add(KeyValuePair pair){ this[pair.Key] = pair; }
public HxXWDatabaseRecord(Session session, KeyValuePair aParams) : this(session, aParams, false) { }