コード例 #1
0
        /// <summary>
        /// this function produces the following xml blob
        ///     <AccountData>
        ///			<UserProperties>
        ///				<UserProperty Name="" Value=""/>
        ///				<UserProperty Name="" Value=""/>
        ///				<UserProperty Name="" Value=""/>
        ///				...
        ///			</UserProperties>
        ///		</AccountData>
        /// </summary>
        public static XmlDocument CreateAccountDataXml(ServerAccount account)
        {
            UserProperties userProperties    = account.UserProperties;
            XmlDocument    userPropertiesXml = null;

            UserProperties.UserPropertiesToXml(userProperties, out userPropertiesXml);
            XmlNode userPropertiesXmlNode = userPropertiesXml.SelectSingleNode(ConstStrings.kUserProperties);

            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("<" + ConstStrings.kAccountData + ">");
            if (userPropertiesXmlNode != null)
            {
                stringBuilder.Append(userPropertiesXmlNode.OuterXml);
            }
            stringBuilder.Append("</" + ConstStrings.kAccountData + ">");

            XmlDocument returnedXmlDocument = new XmlDocument();

            returnedXmlDocument.LoadXml(stringBuilder.ToString());
            return(returnedXmlDocument);
        }