private static EndpointAddress ReadFromInternal (
AddressingVersion addressingVersion,
XmlReader reader, string localName, string ns,
XmlDictionaryString dictLocalName,
XmlDictionaryString dictNS)
{
reader.MoveToContent ();
if (reader.NodeType != XmlNodeType.Element ||
reader.IsEmptyElement)
throw new ArgumentException ("Cannot detect appropriate WS-Addressing Address element.");
if (localName != null)
reader.ReadStartElement (localName, ns);
else if (dictLocalName != null)
((XmlDictionaryReader) reader).ReadStartElement (dictLocalName, dictNS);
else
reader.ReadStartElement ();
reader.MoveToContent ();
if (addressingVersion == null) {
if (reader.NamespaceURI == AddressingVersion.WSAddressing10.Namespace)
addressingVersion = AddressingVersion.WSAddressing10;
else
if (reader.NamespaceURI == AddressingVersion.WSAddressingAugust2004.Namespace)
addressingVersion = AddressingVersion.WSAddressingAugust2004;
else
throw new ArgumentException ("Cannot detect appropriate WS-Addressing version.");
}
EndpointAddress ea = ReadContents (addressingVersion, reader);
reader.MoveToContent ();
reader.ReadEndElement ();
return ea;
}