예제 #1
0
파일: Utils.cs 프로젝트: nolith/tasque
        internal static object Deserialize(System.Xml.XmlNode node, Type type)
        {
            XmlSerializer serializer = GetSerializer(type);

            try
            {
                // Deserialise the web response into the Rtm response object
                System.Xml.XmlNodeReader reader = new System.Xml.XmlNodeReader(node);
                object o = serializer.Deserialize(reader);
                reader.Close();

                return(o);
            }
            catch (InvalidOperationException ex)
            {
                // Serialization error occurred!
                throw new ResponseXmlException("Invalid response received from Rtm.", ex);
            }
        }
예제 #2
0
        private bool ParseCallbackSettingsXML()
        {
            Trace.TraceInformation("Enter.");

            try
            {
                if (xmlDoc == null)
                {
                    Trace.TraceWarning("xmlDoc is null.");
                    return(false);
                }

                System.Xml.XmlNodeReader reader = new System.Xml.XmlNodeReader(xmlDoc);

                List <CallbackContactServiceQueue> _TempQueues = new List <CallbackContactServiceQueue>();

                CallbackContactServiceQueue _cbCSQ = null;
                CallbackContactServiceQueueSettingsProfile _profile = null;

                CallbackBackupCSQ       _bckCSQ = null;
                CallbackAlgorithmFilter _filter = null;

                bool bAcceptCallbacksTimeframeElementEnded = true;
                bool bCallbackProcessingTimeframeEnded     = true;

                bool bCallbackReentryAlgorithmElementBegan = false;
                bool bCallbackOfferedAlgorithmElementBegan = false;

                while (reader.Read())
                {
                    switch (reader.NodeType)
                    {
                    case System.Xml.XmlNodeType.Element:

                        if (reader.Name.Equals("csq"))
                        {
                            _cbCSQ = new CallbackContactServiceQueue();

                            _cbCSQ.Name = reader.GetAttribute("name");

                            bCallbackReentryAlgorithmElementBegan = false;
                            bCallbackOfferedAlgorithmElementBegan = false;
                        }

                        if (reader.Name.Equals("CallbackEnabled"))
                        {
                            try
                            {
                                _cbCSQ.CallbackEnabled = bool.Parse(reader.ReadString());
                            }
                            catch
                            {
                                _cbCSQ.CallbackEnabled = false;
                            }
                        }

                        if (reader.Name.Equals("CallerRecording"))
                        {
                            if (_profile == null)
                            {
                                _profile = new CallbackContactServiceQueueSettingsProfile();
                            }

                            try
                            {
                                _profile.CallerRecording = bool.Parse(reader.ReadString());
                            }
                            catch
                            {
                                _profile.CallerRecording = false;
                            }
                        }

                        if (reader.Name.Equals("RetentionPeriod"))
                        {
                            if (_profile == null)
                            {
                                _profile = new CallbackContactServiceQueueSettingsProfile();
                            }

                            try
                            {
                                _profile.RetentionPeriod = int.Parse(reader.ReadString());
                            }
                            catch
                            {
                                _profile.RetentionPeriod = 7;
                            }
                        }

                        if (reader.Name.Equals("AppServerURLPrefix"))
                        {
                            if (_profile == null)
                            {
                                _profile = new CallbackContactServiceQueueSettingsProfile();
                            }

                            _profile.AppServerURLPrefix = reader.ReadString();
                        }

                        if (reader.Name.Equals("EmailAlerts"))
                        {
                            if (_profile == null)
                            {
                                _profile = new CallbackContactServiceQueueSettingsProfile();
                            }

                            try
                            {
                                _profile.EmailAlerts = bool.Parse(reader.ReadString());
                            }
                            catch
                            {
                                _profile.EmailAlerts = false;
                            }
                        }

                        if (reader.Name.Equals("AdminEmail"))
                        {
                            if (_profile == null)
                            {
                                _profile = new CallbackContactServiceQueueSettingsProfile();
                            }

                            _profile.AdminEmail = reader.ReadString();
                        }

                        if (reader.Name.Equals("CallerIDVerify"))
                        {
                            if (_profile == null)
                            {
                                _profile = new CallbackContactServiceQueueSettingsProfile();
                            }

                            try
                            {
                                _profile.CallerIDVerify = bool.Parse(reader.ReadString());
                            }
                            catch
                            {
                                _profile.CallerIDVerify = false;
                            }
                        }

                        if (reader.Name.Equals("AbandonCallback"))
                        {
                            if (_profile == null)
                            {
                                _profile = new CallbackContactServiceQueueSettingsProfile();
                            }

                            try
                            {
                                _profile.AbandonCallback = bool.Parse(reader.ReadString());
                            }
                            catch
                            {
                                _profile.AbandonCallback = false;
                            }
                        }

                        if (reader.Name.Equals("AbandonCBMinQTime"))
                        {
                            if (_profile == null)
                            {
                                _profile = new CallbackContactServiceQueueSettingsProfile();
                            }

                            try
                            {
                                _profile.AbandonCBMinQTime = int.Parse(reader.ReadString());
                            }
                            catch
                            {
                                _profile.AbandonCBMinQTime = 0;
                            }
                        }

                        if (reader.Name.Equals("AbandonCBMinInterCallTime"))
                        {
                            if (_profile == null)
                            {
                                _profile = new CallbackContactServiceQueueSettingsProfile();
                            }

                            try
                            {
                                _profile.AbandonCBMinInterCallTime = int.Parse(reader.ReadString());
                            }
                            catch
                            {
                                _profile.AbandonCBMinInterCallTime = 0;
                            }
                        }

                        if (reader.Name.Equals("CBQueue"))
                        {
                            if (_profile == null)
                            {
                                _profile = new CallbackContactServiceQueueSettingsProfile();
                            }

                            _bckCSQ = new CallbackBackupCSQ();

                            _bckCSQ.Name = reader.GetAttribute("csq");

                            try
                            {
                                _bckCSQ.OverflowTime = int.Parse(reader.GetAttribute("overflowtime"));
                            }
                            catch
                            {
                                _bckCSQ.OverflowTime = 0;
                            }

                            _profile.BackupCSQs.Add(_bckCSQ);

                            _bckCSQ = null;
                        }

                        if (reader.Name.Equals("AcceptCallbacksTimeframe"))
                        {
                            if (_profile == null)
                            {
                                _profile = new CallbackContactServiceQueueSettingsProfile();
                            }

                            bAcceptCallbacksTimeframeElementEnded = false;
                        }

                        if (reader.Name.Equals("Begin"))
                        {
                            if (!bAcceptCallbacksTimeframeElementEnded)
                            {
                                _profile.AcceptCallbacksTimeframeBegin = reader.ReadString();
                            }

                            if (!bCallbackProcessingTimeframeEnded)
                            {
                                _profile.CallbackProcessingTimeframeBegin = reader.ReadString();
                            }
                        }

                        if (reader.Name.Equals("End"))
                        {
                            if (!bAcceptCallbacksTimeframeElementEnded)
                            {
                                _profile.AcceptCallbacksTimeframeEnd = reader.ReadString();
                            }

                            if (!bCallbackProcessingTimeframeEnded)
                            {
                                _profile.CallbackProcessingTimeframeEnd = reader.ReadString();
                            }
                        }

                        if (reader.Name.Equals("CallbackOfferedAlgorithm"))
                        {
                            bCallbackOfferedAlgorithmElementBegan = true;
                        }

                        if (reader.Name.Equals("CallbackReentryAlgorithm"))
                        {
                            bCallbackReentryAlgorithmElementBegan = true;
                        }

                        if (reader.Name.Equals("TotalInQueue") ||
                            reader.Name.Equals("CSQAgentsReady") ||
                            reader.Name.Equals("CSQCallsWaiting") ||
                            reader.Name.Equals("AgentsLoggedIn") ||
                            reader.Name.Equals("CallsWaiting") ||
                            reader.Name.Equals("LongestQueueTime") ||
                            reader.Name.Equals("CallbackRequests"))
                        {
                            if (_profile == null)
                            {
                                _profile = new CallbackContactServiceQueueSettingsProfile();
                            }

                            _filter = new CallbackAlgorithmFilter();

                            _filter.Name = reader.Name;

                            try
                            {
                                _filter.Enabled = bool.Parse(reader.GetAttribute("Enabled"));
                            }
                            catch
                            {
                                _filter.Enabled = false;
                            }

                            _filter.Operation = reader.GetAttribute("Operation");

                            try
                            {
                                _filter.Value = int.Parse(reader.GetAttribute("Value"));
                            }
                            catch
                            {
                                _filter.Value = 0;
                            }

                            if (bCallbackOfferedAlgorithmElementBegan)
                            {
                                _profile.OfferedAlgorithmFilters.Add(_filter);
                            }

                            if (bCallbackReentryAlgorithmElementBegan)
                            {
                                _profile.ReentryAlgorithmFilters.Add(_filter);
                            }

                            _filter = null;
                        }

                        if (reader.Name.Equals("CallbackProcessingTimeframe"))
                        {
                            if (_profile == null)
                            {
                                _profile = new CallbackContactServiceQueueSettingsProfile();
                            }

                            bCallbackProcessingTimeframeEnded = false;
                        }

                        if (reader.Name.Equals("EndOfDayPurgeCallbackRequests"))
                        {
                            if (_profile == null)
                            {
                                _profile = new CallbackContactServiceQueueSettingsProfile();
                            }

                            try
                            {
                                _profile.EndOfDayPurgeCallbackRequests = bool.Parse(reader.ReadString());
                            }
                            catch
                            {
                                _profile.EndOfDayPurgeCallbackRequests = false;
                            }
                        }

                        break;

                    case System.Xml.XmlNodeType.EndElement:

                        if (reader.Name.Equals("csq"))
                        {
                            if (_cbCSQ != null)
                            {
                                _cbCSQ.Profile = _profile;
                                _TempQueues.Add(_cbCSQ);
                            }
                            else
                            {
                                Trace.TraceWarning("CSQ was not added to list because _cbCSQ is null.");
                            }

                            _profile = null;
                            _cbCSQ   = null;
                        }

                        if (reader.Name.Equals("CallbackReentryAlgorithm"))
                        {
                            bCallbackReentryAlgorithmElementBegan = false;
                        }

                        if (reader.Name.Equals("AcceptCallbacksTimeframe"))
                        {
                            bAcceptCallbacksTimeframeElementEnded = true;
                        }

                        if (reader.Name.Equals("CallbackOfferedAlgorithm"))
                        {
                            bCallbackOfferedAlgorithmElementBegan = false;
                        }

                        if (reader.Name.Equals("CallbackProcessingTimeframe"))
                        {
                            bCallbackProcessingTimeframeEnded = true;
                        }

                        break;
                    } //switch (reader.NodeType)
                }     //while (reader.Read())

                reader.Close();
                reader = null;

                xmlDoc = null;

                _Queues = _TempQueues;

                _TempQueues = null;
                _profile    = null;
                _cbCSQ      = null;

                return(true);
            }
            catch (Exception ex)
            {
                Trace.TraceError("Exception:" + ex.Message + Environment.NewLine + "StackTrace:" + ex.StackTrace);
                xmlDoc = null;
                return(false);
            }
        }
예제 #3
0
		internal static object Deserialize(System.Xml.XmlNode node, Type type)
		{
			XmlSerializer serializer = GetSerializer(type);
			try
			{
				// Deserialise the web response into the Flickr response object
				System.Xml.XmlNodeReader reader = new System.Xml.XmlNodeReader(node);
				object o = serializer.Deserialize(reader);
				reader.Close();

				return o;
			}
			catch(InvalidOperationException ex)
			{
				// Serialization error occurred!
				throw new ResponseXmlException("Invalid response received from Flickr.", ex);
			}
		}
        public ApplicationTypes.ApplicationSettingsReturn Load()
        {
            Trace.TraceInformation("Enter.");

            try
            {
                if (!System.IO.File.Exists(APPLICATIONSETTINGSFILEPATH + "\\" + Constants.APPLICATIONSETTINGSFILENAME))
                {
                    Trace.TraceWarning(APPLICATIONSETTINGSFILEPATH + "\\" + Constants.APPLICATIONSETTINGSFILENAME + " was not found.");
                    _LastOperationReturn = ApplicationTypes.ApplicationSettingsReturn.FILE_NOT_FOUND;
                    return(_LastOperationReturn);
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError("Exception:" + ex.Message + Environment.NewLine + "StackTrace:" + ex.StackTrace);
                _LastOperationReturn = ApplicationTypes.ApplicationSettingsReturn.ERROR;
                return(_LastOperationReturn);
            }

            try
            {
                _encDec = new com.workflowconcepts.utilities.AESSymmetricEncryption(Constants.ENCRYPTION_PASSWORD, Constants.ENCRYPTION_SALT);

                System.Xml.XmlDocument   xmlDoc = null;
                System.Xml.XmlNodeReader reader = null;

                xmlDoc = new System.Xml.XmlDocument();

                xmlDoc.Load(APPLICATIONSETTINGSFILEPATH + "\\" + Constants.APPLICATIONSETTINGSFILENAME);

                reader = new System.Xml.XmlNodeReader(xmlDoc);

                while (reader.Read())
                {
                    switch (reader.NodeType)
                    {
                    case System.Xml.XmlNodeType.Element:

                        if (reader.Name.Equals("WebServer"))
                        {
                            _WebServerIP                 = reader.GetAttribute("IP");
                            _WebServerPort               = reader.GetAttribute("Port");
                            _WebServerPrefix             = reader.GetAttribute("Prefix");
                            _WebServerDataCollectionPort = reader.GetAttribute("DataCollectionPort");
                        }

                        if (reader.Name.Equals("EmailNotifications"))
                        {
                            _EmailFrom       = reader.GetAttribute("EmailFrom");
                            _EmailTo         = reader.GetAttribute("EmailTo");
                            _EmailSMTPServer = reader.GetAttribute("SMTPServer");
                            _EmailSMTPPort   = reader.GetAttribute("SMTPPort");

                            try
                            {
                                _EmailSMTPUserName = _encDec.Decrypt(reader.GetAttribute("SMTPUser"));
                            }
                            catch
                            {
                                _EmailSMTPUserName = string.Empty;
                            }

                            try
                            {
                                _EmailSMTPPassword = _encDec.Decrypt(reader.GetAttribute("SMTPPassword"));
                            }
                            catch
                            {
                                _EmailSMTPPassword = string.Empty;
                            }

                            try
                            {
                                _EmailOnFailure = Boolean.Parse(reader.GetAttribute("OnFailure"));
                            }
                            catch
                            {
                                _EmailOnFailure = true;
                            }

                            try
                            {
                                _EmailOnSuccess = Boolean.Parse(reader.GetAttribute("OnSuccess"));
                            }
                            catch
                            {
                                _EmailOnSuccess = false;
                            }
                        }

                        if (reader.Name.Equals("UCCX"))
                        {
                            _UCCXNode1IPAddress         = reader.GetAttribute("Node1IPAddress");
                            _UCCXNode2IPAddress         = reader.GetAttribute("Node2IPAddress");
                            _UCCXApplicationPort        = reader.GetAttribute("ApplicationPort");
                            _UCCXRealtimeDataPort       = reader.GetAttribute("RealtimeDataPort");
                            _UCCXAuthorizationPrefix    = reader.GetAttribute("AuthorizationPrefix");
                            _UCCXCallbackPrefix         = reader.GetAttribute("CallbackPrefix");
                            _UCCXNumberOfIVRPorts       = reader.GetAttribute("NumberOfIVRPorts");
                            _UCCXMaxIVRPortUsagePercent = reader.GetAttribute("MaxIVRPortUsagePercent");

                            try
                            {
                                int iUCCXMaxLicenseUsagePercent = int.Parse(_UCCXMaxIVRPortUsagePercent);

                                if (iUCCXMaxLicenseUsagePercent < 0)
                                {
                                    _UCCXMaxIVRPortUsagePercent = "0";
                                }

                                if (iUCCXMaxLicenseUsagePercent >= 100)
                                {
                                    _UCCXMaxIVRPortUsagePercent = "99";
                                }
                            }
                            catch
                            {
                                _UCCXMaxIVRPortUsagePercent = "0";
                            }

                            try
                            {
                                int iUccxNumberOfLicenses = int.Parse(_UCCXNumberOfIVRPorts);

                                if (iUccxNumberOfLicenses < 0)
                                {
                                    _UCCXNumberOfIVRPorts = "0";
                                }
                            }
                            catch
                            {
                                _UCCXNumberOfIVRPorts = "0";
                            }

                            try
                            {
                                _UCCXAdminUser          = _encDec.Decrypt(reader.GetAttribute("AdminUser"));
                                _EncryptedUCCXAdminUser = reader.GetAttribute("AdminUser");
                            }
                            catch
                            {
                                _UCCXAdminUser = String.Empty;
                            }

                            try
                            {
                                _UCCXAdminPassword          = _encDec.Decrypt(reader.GetAttribute("AdminPassword"));
                                _EncryptedUCCXAdminPassword = reader.GetAttribute("AdminPassword");
                            }
                            catch
                            {
                                _UCCXAdminPassword = String.Empty;
                            }
                        }

                        if (reader.Name.Equals("CallbackRecords"))
                        {
                            try
                            {
                                _MaximumNumberOfDays = int.Parse(reader.GetAttribute("MaximumNumberOfDays"));

                                if (_MaximumNumberOfDays < 0)
                                {
                                    _MaximumNumberOfDays = Constants.MAXIMUM_NUMBER_OF_DAYS;
                                }
                            }
                            catch
                            {
                                _MaximumNumberOfDays = Constants.MAXIMUM_NUMBER_OF_DAYS;
                            }

                            try
                            {
                                _MaximumNumberOfAttempts = int.Parse(reader.GetAttribute("MaximumNumberOfAttempts"));

                                if (_MaximumNumberOfAttempts <= 0)
                                {
                                    _MaximumNumberOfAttempts = Constants.MAXIMUM_NUMBER_OF_ATTEMPTS;
                                }
                            }
                            catch
                            {
                                _MaximumNumberOfAttempts = Constants.MAXIMUM_NUMBER_OF_ATTEMPTS;
                            }

                            try
                            {
                                _MinimumIntervalBetweenRetries = int.Parse(reader.GetAttribute("MinimumIntervalBetweenRetries"));

                                if (_MinimumIntervalBetweenRetries <= 0)
                                {
                                    _MinimumIntervalBetweenRetries = Constants.MINIMUM_INTERVAL_BETWEEN_RETRIES;
                                }
                            }
                            catch
                            {
                                _MinimumIntervalBetweenRetries = Constants.MINIMUM_INTERVAL_BETWEEN_RETRIES;
                            }
                        }

                        if (reader.Name.Equals("BasicInsertionThrottling"))
                        {
                            try
                            {
                                _BasicInsertionThrottling_Enabled = Boolean.Parse(reader.GetAttribute("Enabled"));
                            }
                            catch
                            {
                                _BasicInsertionThrottling_Enabled = false;
                            }

                            try
                            {
                                _BasicInsertionThrottling_MaximumRecordsAtATime = int.Parse(reader.GetAttribute("MaximumAtATime"));

                                if (_BasicInsertionThrottling_MaximumRecordsAtATime <= 0)
                                {
                                    _BasicInsertionThrottling_MaximumRecordsAtATime = Constants.BASIC_INSERTION_THROTTLING_MAXIMUM_RECORDS_AT_A_TIME;
                                }
                            }
                            catch
                            {
                                _BasicInsertionThrottling_MaximumRecordsAtATime = Constants.BASIC_INSERTION_THROTTLING_MAXIMUM_RECORDS_AT_A_TIME;
                            }
                        }

                        if (reader.Name.Equals("API"))
                        {
                            try
                            {
                                _NumberOfAPIThreads = int.Parse(reader.GetAttribute("NumberOfHandlerThreads"));

                                if (_NumberOfAPIThreads <= 0)
                                {
                                    _NumberOfAPIThreads = Constants.NUMBER_OF_HANDLER_THREADS;
                                }
                            }
                            catch
                            {
                                _NumberOfAPIThreads = Constants.NUMBER_OF_HANDLER_THREADS;
                            }

                            try
                            {
                                _APIHandlerThreadsSleep = int.Parse(reader.GetAttribute("HandlerThreadsSleep"));

                                if (_APIHandlerThreadsSleep <= 0)
                                {
                                    _APIHandlerThreadsSleep = Constants.API_HANDLER_THREADS_SLEEP;
                                }
                            }
                            catch
                            {
                                _APIHandlerThreadsSleep = Constants.API_HANDLER_THREADS_SLEEP;
                            }
                        }

                        if (reader.Name.Equals("Debug"))
                        {
                            try
                            {
                                _DebugEnabled = Boolean.Parse(reader.GetAttribute("Enabled"));
                            }
                            catch
                            {
                                _DebugEnabled = false;
                            }

                            _DebugLevel       = reader.GetAttribute("Level");
                            _DebugRetainUnit  = reader.GetAttribute("RetainUnit");
                            _DebugRetainValue = reader.GetAttribute("RetainValue");
                        }

                        break;
                    }
                }

                reader.Close();
                reader = null;

                xmlDoc = null;

                _encDec = null;

                _LastOperationReturn = ApplicationTypes.ApplicationSettingsReturn.SUCCESS;
                return(_LastOperationReturn);
            }
            catch (Exception ex)
            {
                _encDec = null;
                Trace.TraceError("Exception:" + ex.Message + Environment.NewLine + "StackTrace:" + ex.StackTrace);
                _LastOperationReturn = ApplicationTypes.ApplicationSettingsReturn.ERROR;
                return(_LastOperationReturn);
            }
        }
예제 #5
0
파일: Feed.cs 프로젝트: xxjeng/nuxleus
        private void InitializeXmlNamespaceManager(bool i_AddFeedSyncNamespace)
        {
            System.Diagnostics.Debug.Assert(m_XmlDocument != null);
            System.Diagnostics.Debug.Assert(m_XmlNamespaceManager != null);

            if (i_AddFeedSyncNamespace)
            {
                m_XmlDocument.DocumentElement.SetAttribute
                    (
                    "xmlns:" + Microsoft.Samples.FeedSync.Constants.FEEDSYNC_XML_NAMESPACE_PREFIX,
                    Microsoft.Samples.FeedSync.Constants.FEEDSYNC_XML_NAMESPACE_URI
                    );
            }

            #region Populate namespaces into XmlNamespaceManager instance

            System.Xml.XmlReader XmlReader = new System.Xml.XmlNodeReader(m_XmlDocument);

            while (XmlReader.Read())
            {
                XmlReader.MoveToFirstAttribute();
                do
                {
                    if (XmlReader.Name.StartsWith("xmlns:") || (XmlReader.Name == "xmlns"))
                    {
                        string NamespacePrefix = System.String.Empty;
                        string NamespaceValue = System.String.Empty;

                        if (XmlReader.Name.StartsWith("xmlns:"))
                            NamespacePrefix = XmlReader.Name.Substring(XmlReader.Name.IndexOf(':') + 1);

                        NamespaceValue = XmlReader.Value;

                        if (!System.String.IsNullOrEmpty(NamespaceValue))
                            m_XmlNamespaceManager.AddNamespace(NamespacePrefix, NamespaceValue);
                    }
                }
                while (XmlReader.MoveToNextAttribute());
            }

            XmlReader.Close();

            #endregion

            #region Get/set namespace prefix for subsequent xpath queries

            foreach (System.Collections.Generic.KeyValuePair<string, string> KeyValuePair in m_XmlNamespaceManager.GetNamespacesInScope(System.Xml.XmlNamespaceScope.All))
            {
                if (KeyValuePair.Value == Microsoft.Samples.FeedSync.Constants.FEEDSYNC_XML_NAMESPACE_URI)
                {
                    if (KeyValuePair.Key == Microsoft.Samples.FeedSync.Constants.FEEDSYNC_XML_NAMESPACE_PREFIX)
                    {
                        m_FeedSyncNamespacePrefix = Microsoft.Samples.FeedSync.Constants.FEEDSYNC_XML_NAMESPACE_PREFIX;
                        continue;
                    }

                    //  Check for default namespace
                    if (System.String.IsNullOrEmpty(KeyValuePair.Key))
                    {
                        //  See if sse prefix used
                        if (!m_XmlNamespaceManager.HasNamespace(Microsoft.Samples.FeedSync.Constants.FEEDSYNC_XML_NAMESPACE_PREFIX))
                        {
                            m_FeedSyncNamespacePrefix = Microsoft.Samples.FeedSync.Constants.FEEDSYNC_XML_NAMESPACE_PREFIX;
                        }
                        else
                        {
                            //  See if sse prefix is mapped to atom namespace uri
                            string NamespaceURI = m_XmlNamespaceManager.LookupNamespace(Microsoft.Samples.FeedSync.Constants.FEEDSYNC_XML_NAMESPACE_PREFIX);
                            if (NamespaceURI == Microsoft.Samples.FeedSync.Constants.FEEDSYNC_XML_NAMESPACE_URI)
                                m_FeedSyncNamespacePrefix = Microsoft.Samples.FeedSync.Constants.FEEDSYNC_XML_NAMESPACE_PREFIX;
                            else
                            {
                                //  Create a new prefix
                                m_FeedSyncNamespacePrefix = Microsoft.Samples.FeedSync.Constants.FEEDSYNC_XML_NAMESPACE_PREFIX + System.Guid.NewGuid().ToString();
                            }
                        }

                        //  Add namespace with mapped prefix
                        m_XmlNamespaceManager.AddNamespace
                            (
                            m_FeedSyncNamespacePrefix,
                            Microsoft.Samples.FeedSync.Constants.FEEDSYNC_XML_NAMESPACE_URI
                            );
                    }

                    if (System.String.IsNullOrEmpty(m_FeedSyncNamespacePrefix))
                        throw new System.Exception("Invalid FeedSync XML document!");
                }
                else if (KeyValuePair.Value == Microsoft.Samples.FeedSync.Constants.ATOM_XML_NAMESPACE_URI)
                {
                    if (KeyValuePair.Key == Microsoft.Samples.FeedSync.Constants.ATOM_XML_NAMESPACE_PREFIX)
                    {
                        m_AtomNamespacePrefix = Microsoft.Samples.FeedSync.Constants.ATOM_XML_NAMESPACE_PREFIX;
                        continue;
                    }

                    //  Check for default namespace
                    if (System.String.IsNullOrEmpty(KeyValuePair.Key))
                    {
                        //  See if atom prefix used
                        if (!m_XmlNamespaceManager.HasNamespace(Microsoft.Samples.FeedSync.Constants.ATOM_XML_NAMESPACE_PREFIX))
                        {
                            m_AtomNamespacePrefix = Microsoft.Samples.FeedSync.Constants.ATOM_XML_NAMESPACE_PREFIX;
                        }
                        else
                        {
                            //  See if atom prefix is mapped to atom namespace uri
                            string NamespaceURI = m_XmlNamespaceManager.LookupNamespace(Microsoft.Samples.FeedSync.Constants.ATOM_XML_NAMESPACE_PREFIX);
                            if (NamespaceURI == Microsoft.Samples.FeedSync.Constants.ATOM_XML_NAMESPACE_URI)
                                m_AtomNamespacePrefix = Microsoft.Samples.FeedSync.Constants.ATOM_XML_NAMESPACE_PREFIX;
                            else
                            {
                                //  Create a new prefix
                                m_AtomNamespacePrefix = Microsoft.Samples.FeedSync.Constants.ATOM_XML_NAMESPACE_PREFIX + System.Guid.NewGuid().ToString();
                            }
                        }

                        //  Add namespace with mapped prefix
                        m_XmlNamespaceManager.AddNamespace
                            (
                            m_AtomNamespacePrefix,
                            Microsoft.Samples.FeedSync.Constants.ATOM_XML_NAMESPACE_URI
                            );
                    }

                    if (System.String.IsNullOrEmpty(m_AtomNamespacePrefix))
                        throw new System.Exception("Invalid Atom XML document!");
                }
            }

            #endregion
        }