internal static EndpointAddress ReadFrom(XmlDictionaryReader reader, XmlDictionaryString localName, XmlDictionaryString ns, out AddressingVersion version)
{
if (reader == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader");
}
reader.ReadFullStartElement(localName, ns);
reader.MoveToContent();
if (reader.IsNamespaceUri(AddressingVersion.WSAddressing10.DictionaryNamespace))
{
version = AddressingVersion.WSAddressing10;
}
else if (reader.IsNamespaceUri(AddressingVersion.WSAddressingAugust2004.DictionaryNamespace))
{
version = AddressingVersion.WSAddressingAugust2004;
}
else
{
if (reader.NodeType != XmlNodeType.Element)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("reader", System.ServiceModel.SR.GetString("CannotDetectAddressingVersion"));
}
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("reader", System.ServiceModel.SR.GetString("AddressingVersionNotSupported", new object[] { reader.NamespaceURI }));
}
EndpointAddress address = ReadFromDriver(version, reader);
reader.ReadEndElement();
return address;
}