private static string[] GetSchemaStringFromWsdlFile(string schemaLoadPath)
{
List<string> schemas = new List<string>();
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(schemaLoadPath);
XmlNodeList wsdlTypes = xmlDoc.GetElementsByTagName("wsdl:types");
XmlNodeList wsdlDefinitions = xmlDoc.GetElementsByTagName("wsdl:definitions");
if (wsdlTypes != null && wsdlTypes.Count == 1)
{
foreach (XmlNode schemaElement in wsdlTypes[0].ChildNodes)
{
if (schemaElement.NodeType != XmlNodeType.Comment)
{
foreach (XmlAttribute attribute in wsdlDefinitions[0].Attributes)
{
if (attribute.Prefix == "xmlns" && schemaElement.Attributes.GetNamedItem(attribute.Name) == null)
{
XmlAttribute namespaceAttribute = (XmlAttribute)attribute.Clone();
schemaElement.Attributes.Append(namespaceAttribute);
}
}
schemas.Add(schemaElement.OuterXml);
}
}
}
return schemas.ToArray();
}
}