public ReturnValue(int code, String name, String val)
 {
     this.code = code;
     this.val  = val;
     this.name = name;
     type      = ReturnValueTypes.STRING;
 }
        //Not sure this is going to meet our needs.  It is a port from the Java side.
        //the Java side could tell all fields as strings, but I'm not sure that applies here.
        public Hashtable GetHashtable()
        {
            Hashtable   table = new Hashtable();
            IEnumerator ienum = values.GetEnumerator();

            while (ienum.MoveNext())
            {
                ReturnValue      rv     = (ReturnValue)(ienum.Current);
                String           name   = rv.GetName();
                ReturnValueTypes type   = rv.GetValueType();
                bool             isList = rv.IsList();
                if (!isList)
                {
                    table[name] = rv.GetStringValue();
                }
                else
                {
                    table[name] = rv.GetList();
                }
            }

            return(table);
        }
 public void SetType(ReturnValueTypes type)
 {
     this.type = type;
 }
        private void Parse(XmlNode node)
        {
            XmlAttributeCollection attrs = node.Attributes;
            String codeStr = GetAttribute(attrs, "code");

            if (codeStr == null)
            {
                throw new XmlException(Resources.CODE_IS_MISSING, new Exception());
            }
            code = Int32.Parse(codeStr);
            if (code == ReturnCodes.INTERNAL_ERROR)
            {
                code = ReturnCodes.UNKNOWN_AGENT_FAILURE;
            }

            name = GetAttribute(attrs, "name");
            String typeStr = GetAttribute(attrs, "type");

            if (typeStr == null)
            {
                type = ReturnValueTypes.STRING;
            }
            else if (typeStr.Equals("date"))
            {
                type = ReturnValueTypes.DATE;
            }
            else if (typeStr.Equals("time"))
            {
                type = ReturnValueTypes.TIME;
            }
            else if (typeStr.Equals("boolean"))
            {
                type = ReturnValueTypes.BOOLEAN;
            }
            else
            {
                type = ReturnValueTypes.STRING;
            }

            color = GetAttribute(attrs, "color");

            String listNode = GetAttribute(attrs, "list");

            if (listNode != null)
            {
                isList = String.Equals(listNode.ToLower(), "true");
            }

            XmlNodeList values = node.SelectNodes("value");

            if (!isList)
            {
                XmlNode valNode = values.Item(0);
                if (valNode != null)
                {
                    val = valNode.InnerText;
                }
            }
            else
            {
                originalList = new ArrayList();
                for (int j = 0; j < values.Count; j++)
                {
                    XmlNode valueNode = values.Item(j);
                    if (valueNode != null)
                    {
                        if (String.Equals(valueNode.Name.ToLower(), "value"))
                        {
                            XmlAttributeCollection valueAttrs = valueNode.Attributes;
                            String fieldName = GetAttribute(valueAttrs, "field");
                            if (fieldName != null)
                            {
                                IReturnValueField rvf =
                                    new ReturnValueField(valueNode.InnerText, fieldName);
                                // add an rvf to the list
                                originalList.Add(rvf);
                            }
                            else
                            {
                                // add a plain string to the list
                                originalList.Add(valueNode.InnerText);
                            }
                        }
                    }
                }

                // Initializes stringList
                SetList(originalList);
            }

            /*
             * NodeList nodes = node.getChildNodes();
             * if (!isList)
             * {
             *  value = this.getFirstValue(nodes,"value");
             * }
             * else
             * {
             *  list = new IList();
             *  for (int j = 0; j < nodes.getLength(); j++)
             *  {
             *      Node valNode = nodes.item(j);
             *      if (valNode != null)
             *      {
             *          if (valNode.getNodeName().equalsIgnoreCase("value"))
             *          {
             *              Node textNode = valNode.getFirstChild();
             *              list.add(textNode.getNodeValue());
             *          }
             *      }
             *  }
             * }
             */
            XmlNodeList texts    = node.SelectNodes("text");
            XmlNode     textNode = texts.Item(0);

            if (textNode != null)
            {
                text = textNode.InnerText;
            }
        }