public static void chatBuddiesUpdate(XmlTextWriter xtw, string id, bool client, string messageID, ChatBuddy chatBuddy)
        {
            xtw.WriteStartDocument();
            //open pvctd tag
            xtw.WriteStartElement("pvctd", "columbia-psl-memento-pervasive-hermes");
            //open message element
            xtw.WriteStartElement("message");
            //open connect element of message
            xtw.WriteStartElement("chatBuddiesUpdate");



            xtw.WriteStartElement("chatBuddy");

            xtw.WriteStartElement("ip");
            xtw.WriteString(chatBuddy.getIP());
            xtw.WriteEndElement();
            xtw.WriteStartElement("chatName");
            xtw.WriteString(chatBuddy.getChatName());
            xtw.WriteEndElement();
            xtw.WriteStartElement("status");
            xtw.WriteString(chatBuddy.getStatus());
            xtw.WriteEndElement();
            xtw.WriteStartElement("clientID");
            xtw.WriteString(chatBuddy.getID());
            xtw.WriteEndElement();
            xtw.WriteEndElement();


            //**********

            //close
            xtw.WriteEndElement();
            //close message
            xtw.WriteEndElement();

            //open time element
            xtw.WriteStartElement("time");
            xtw.WriteString(System.DateTime.Now.ToString());
            xtw.WriteEndElement();
            //open id
            xtw.WriteStartElement("id");
            xtw.WriteString(id);
            xtw.WriteEndElement();

            //clientID or serverID
            if (client)
            {
                xtw.WriteStartElement("clientID");
            }
            else
            {
                xtw.WriteStartElement("serverID");
            }
            xtw.WriteString(id);
            xtw.WriteEndElement();

            //close it all up
            xtw.WriteEndElement();
            xtw.WriteEndDocument();
            xtw.Flush();
        }
        public static void confirmConnect(XmlTextWriter xtw, string id, bool client, string messageID, string clientID, ArrayList chatBuddies, string serverID)
        {
            xtw.WriteStartDocument();
            //open pvctd tag
            xtw.WriteStartElement("pvctd", "columbia-psl-memento-pervasive-hermes");
            //open message element
            xtw.WriteStartElement("message");
            //open connect element of message
            xtw.WriteStartElement("confirmConnect");

            //open and close all your internal elements here
            xtw.WriteStartElement("clientID");
            xtw.WriteString(clientID);
            xtw.WriteEndElement();

            xtw.WriteStartElement("chatBuddies");

            //we add a chat buddy for each one in the list of chat buddies

            object[] buddies = chatBuddies.ToArray();
            xtw.WriteAttributeString("chatBuddiesCount", buddies.Length.ToString());
            //xtw.WriteAttributeString("chatBuddies", "buddyCount", "columbia-psl-memento-pervasive-hermes", buddies.Length.ToString());
            //xtw.WriteEndAttribute();

            if (buddies.Length > 0)
            {
                for (int i = 0; i < buddies.Length; i++)
                {
                    ChatBuddy chatBuddy = (ChatBuddy)buddies[i];
                    xtw.WriteStartElement("chatBuddy");
                    xtw.WriteStartElement("ip");
                    xtw.WriteString(chatBuddy.getIP());
                    xtw.WriteEndElement();
                    xtw.WriteStartElement("chatName");
                    xtw.WriteString(chatBuddy.getChatName());
                    xtw.WriteEndElement();
                    xtw.WriteStartElement("status");
                    xtw.WriteString(chatBuddy.getStatus());
                    xtw.WriteEndElement();
                    xtw.WriteStartElement("clientID");
                    xtw.WriteString(chatBuddy.getID());
                    xtw.WriteEndElement();
                    xtw.WriteEndElement();
                }
            }

            xtw.WriteEndElement();
            //serverID element
            xtw.WriteStartElement("serverID");
            xtw.WriteString(serverID);
            xtw.WriteEndElement();
            //**********

            //close
            xtw.WriteEndElement();
            //close message
            xtw.WriteEndElement();

            //open time element
            xtw.WriteStartElement("time");
            xtw.WriteString(System.DateTime.Now.ToString());
            xtw.WriteEndElement();
            //open id
            xtw.WriteStartElement("id");
            xtw.WriteString(id);
            xtw.WriteEndElement();

            //clientID or serverID
            if (client)
            {
                xtw.WriteStartElement("clientID");
            }
            else
            {
                xtw.WriteStartElement("serverID");
            }
            xtw.WriteString(id);
            xtw.WriteEndElement();

            //close it all up
            xtw.WriteEndElement();
            xtw.WriteEndDocument();
            xtw.Flush();
        }