Microsoft.Protocols.TestSuites.Common.ActiveSyncClient.GetTargetNamespace C# (CSharp) Method

GetTargetNamespace() private static method

Get the target namespace of the schema
private static GetTargetNamespace ( string schema ) : string
schema string The schema string
return string
        private static string GetTargetNamespace(string schema)
        {
            XmlDocument xd = new XmlDocument();
            xd.LoadXml(schema);

            if (xd.ChildNodes.Count <= 1)
            {
                throw new XmlException("Can't find schema element in " + xd.Name);
            }

            if (xd.ChildNodes[1].Attributes != null)
            {
                XmlAttributeCollection attributeList = xd.ChildNodes[1].Attributes;
                return attributeList["targetNamespace"] == null ? string.Empty : attributeList["targetNamespace"].Value;
            }

            return null;
        }