本文整理汇总了C#中System.Xml.XmlDictionary类的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionary类的具体用法?C# XmlDictionary怎么用?C# XmlDictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlDictionary类属于System.Xml命名空间,在下文中一共展示了XmlDictionary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryResolveType
public override bool TryResolveType(Type type, Type declaredType, DataContractResolver knownTypeResolver,
out System.Xml.XmlDictionaryString typeName,
out System.Xml.XmlDictionaryString typeNamespace)
{
if (type == null)
throw new ArgumentNullException("type");
if (declaredType == null)
throw new ArgumentNullException("declaredType");
if (knownTypeResolver == null)
throw new ArgumentNullException("knownTypeResolver");
if (knownTypeResolver.TryResolveType(type, declaredType, knownTypeResolver, out typeName, out typeNamespace))
return true;
if (type.IsPrimitive && declaredType == typeof(object))
{
return knownTypeResolver.TryResolveType(type, type, knownTypeResolver, out typeName, out typeNamespace);
}
XmlDictionary dict = new XmlDictionary();
typeNamespace = dict.Add(xmlNamespace);
typeName = dict.Add(type.AssemblyQualifiedName);
return true;
}
示例2: TryResolveType
/// <summary>
/// Override this method to map a data contract type to an xsi:type name and namespace during serialization.
/// </summary>
/// <param name="type">The type to map.</param>
/// <param name="declaredType">The type declared in the data contract.</param>
/// <param name="knownTypeResolver">The known type resolver.</param>
/// <param name="typeName">The xsi:type name.</param>
/// <param name="typeNamespace">The xsi:type namespace.</param>
/// <returns>
/// true if mapping succeeded; otherwise, false.
/// </returns>
public override bool TryResolveType(Type type, Type declaredType, DataContractResolver knownTypeResolver, out System.Xml.XmlDictionaryString typeName, out System.Xml.XmlDictionaryString typeNamespace)
{
if (type == typeof(Tag))
{
XmlDictionary dictionary = new XmlDictionary();
typeName = dictionary.Add("Tag");
typeNamespace = dictionary.Add(uri);
return true;
}
else if (type == typeof(Entry))
{
XmlDictionary dictionary = new XmlDictionary();
typeName = dictionary.Add("Entry");
typeNamespace = dictionary.Add(uri);
return true;
}
else if (type == typeof(LinkEntry))
{
XmlDictionary dictionary = new XmlDictionary();
typeName = dictionary.Add("LinkEntry");
typeNamespace = dictionary.Add(uri);
return true;
}
else if (type == typeof(LinkItem))
{
XmlDictionary dictionary = new XmlDictionary();
typeName = dictionary.Add("LinkItem");
typeNamespace = dictionary.Add(uri);
return true;
}
else
return knownTypeResolver.TryResolveType(type, declaredType, knownTypeResolver, out typeName, out typeNamespace);
}
示例3: TryResolveType
// Serialization
public override bool TryResolveType(Type type, Type declaredType, DataContractResolver knownTypeResolver, out System.Xml.XmlDictionaryString typeName, out System.Xml.XmlDictionaryString typeNamespace)
{
Type[] genericTypes = type.GetGenericArguments();
string ns = string.Empty;
Type genericType = null;
foreach (Type genType in genericTypes)
{
if (typesByType.ContainsKey(genType) == true)
{
typesByType.TryGetValue(genType, out ns);
genericType = genType;
break;
}
}
if (string.IsNullOrEmpty(ns) == false)
{
XmlDictionary dictionary = new XmlDictionary();
typeName = dictionary.Add(genericType.Name);
typeNamespace = dictionary.Add(ns);
return true;
}
else
{
return knownTypeResolver.TryResolveType(type, declaredType, null, out typeName, out typeNamespace);
}
}
示例4: Wsrm11Dictionary
public Wsrm11Dictionary(XmlDictionary dictionary)
{
this.AckRequestedAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/AckRequested");
this.CloseSequence = dictionary.Add("CloseSequence");
this.CloseSequenceAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/CloseSequence");
this.CloseSequenceResponse = dictionary.Add("CloseSequenceResponse");
this.CloseSequenceResponseAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/CloseSequenceResponse");
this.CreateSequenceAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/CreateSequence");
this.CreateSequenceResponseAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/CreateSequenceResponse");
this.DiscardFollowingFirstGap = dictionary.Add("DiscardFollowingFirstGap");
this.Endpoint = dictionary.Add("Endpoint");
this.FaultAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/fault");
this.Final = dictionary.Add("Final");
this.IncompleteSequenceBehavior = dictionary.Add("IncompleteSequenceBehavior");
this.LastMsgNumber = dictionary.Add("LastMsgNumber");
this.MaxMessageNumber = dictionary.Add("MaxMessageNumber");
this.Namespace = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702");
this.NoDiscard = dictionary.Add("NoDiscard");
this.None = dictionary.Add("None");
this.SequenceAcknowledgementAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/SequenceAcknowledgement");
this.SequenceClosed = dictionary.Add("SequenceClosed");
this.TerminateSequenceAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/TerminateSequence");
this.TerminateSequenceResponse = dictionary.Add("TerminateSequenceResponse");
this.TerminateSequenceResponseAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/TerminateSequenceResponse");
this.UsesSequenceSSL = dictionary.Add("UsesSequenceSSL");
this.UsesSequenceSTR = dictionary.Add("UsesSequenceSTR");
this.WsrmRequired = dictionary.Add("WsrmRequired");
}
示例5: SecureConversationDec2005Dictionary
public SecureConversationDec2005Dictionary(XmlDictionary dictionary)
{
base.SecurityContextToken = dictionary.Add("SecurityContextToken");
base.AlgorithmAttribute = dictionary.Add("Algorithm");
base.Generation = dictionary.Add("Generation");
base.Label = dictionary.Add("Label");
base.Offset = dictionary.Add("Offset");
base.Properties = dictionary.Add("Properties");
base.Identifier = dictionary.Add("Identifier");
base.Cookie = dictionary.Add("Cookie");
base.RenewNeededFaultCode = dictionary.Add("RenewNeeded");
base.BadContextTokenFaultCode = dictionary.Add("BadContextToken");
base.Prefix = dictionary.Add("sc");
base.DerivedKeyTokenType = dictionary.Add("http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512/dk");
base.SecurityContextTokenType = dictionary.Add("http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512/sct");
base.SecurityContextTokenReferenceValueType = dictionary.Add("http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512/sct");
base.RequestSecurityContextIssuance = dictionary.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/SCT");
base.RequestSecurityContextIssuanceResponse = dictionary.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTR/SCT");
this.RequestSecurityContextRenew = dictionary.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/SCT/Renew");
this.RequestSecurityContextRenewResponse = dictionary.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTR/SCT/Renew");
this.RequestSecurityContextClose = dictionary.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/SCT/Cancel");
this.RequestSecurityContextCloseResponse = dictionary.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTR/SCT/Cancel");
base.Namespace = dictionary.Add("http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512");
base.DerivedKeyToken = dictionary.Add("DerivedKeyToken");
base.Nonce = dictionary.Add("Nonce");
base.Length = dictionary.Add("Length");
this.Instance = dictionary.Add("Instance");
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:SecureConversationDec2005Dictionary.cs
示例6: TryResolveType
public override bool TryResolveType(Type dataContractType, Type declaredType, DataContractResolver knownTypeResolver, out XmlDictionaryString typeName, out XmlDictionaryString typeNamespace)
{
var res = knownTypeResolver.TryResolveType(dataContractType, declaredType, null, out typeName, out typeNamespace);
if (res)
return res;
System.Reflection.Assembly asm = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(p => p == dataContractType.Assembly);
if (asm != null)
{
XmlDictionary dictionary = new XmlDictionary();
typeName = dictionary.Add(dataContractType.Name);
typeNamespace = dictionary.Add("http://tempuri.com/" + asm.FullName);
return true;
}
foreach (IPlugin plugin in PluginHelper.plugins.Values)
{
if (plugin.GetType().Assembly == dataContractType.Assembly){
XmlDictionary dictionary = new XmlDictionary();
typeName = dictionary.Add(dataContractType.Name);
typeNamespace = dictionary.Add("http://tempuri.com/"+ plugin.Name);
return true;
}
}
return false;
}
示例7: SecureConversationVersion
static SecureConversationVersion ()
{
var dic = new XmlDictionary ();
WSSecureConversation13 = new SecureConversationVersionImpl () { Prefix = dic.Add ("wsse"), Namespace = dic.Add ("http://schemas.xmlsoap.org/ws/2002/12/secext") };
WSSecureConversationFeb2005 = new SecureConversationVersionImpl () { Prefix = dic.Add ("wsse"), Namespace = dic.Add ("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd") };
Default = WSSecureConversation13;
}
示例8: TrustVersion
static TrustVersion ()
{
var dic = new XmlDictionary ();
WSTrust13 = new TrustVersionImpl () { Prefix = dic.Add ("wst"), Namespace = dic.Add ("http://docs.oasis-open.org/ws-sx/ws-trust/200512") };
WSTrustFeb2005 = new TrustVersionImpl () { Prefix = dic.Add ("wsse"), Namespace = dic.Add ("http://schemas.xmlsoap.org/ws/2002/12/secext") };
Default = WSTrust13;
}
示例9: InvalidDataContractCriticalHelper
public InvalidDataContractCriticalHelper(Type type)
: base(type)
{
StableName = DataContract.GetStableName(type);
_xmlDictionary = new XmlDictionary(2);
this.Name = this.TopLevelElementName = _xmlDictionary.Add(StableName.Name);
this.Namespace = this.TopLevelElementNamespace = _xmlDictionary.Add(StableName.Namespace);
}
示例10: Empty
public void Empty ()
{
XmlDictionary d = new XmlDictionary ();
XmlDictionaryString dns;
d.Add (String.Empty);
Assert.IsTrue (d.TryLookup (String.Empty, out dns), "#0");
Assert.AreEqual (0, dns.Key, "#1");
}
示例11: Add
public void Add ()
{
XmlDictionary d = new XmlDictionary ();
Assert.AreEqual (0, d.Add ("foo").Key, "#1");
Assert.AreEqual (0, d.Add ("foo").Key, "#2");
Assert.AreEqual (1, d.Add ("bar").Key, "#3");
Assert.AreEqual (2, d.Add ("baz").Key, "#4");
}
示例12: AddToDictionary
private static XmlDictionaryString AddToDictionary(XmlDictionary dictionary, string s)
{
XmlDictionaryString str;
if (!dictionary.TryLookup(s, out str))
{
str = dictionary.Add(s);
}
return str;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:PrimitiveOperationFormatter.cs
示例13: TryAddDuplicate
public void TryAddDuplicate ()
{
XmlDictionary dic = new XmlDictionary ();
XmlDictionaryString d1 = dic.Add ("foo");
XmlBinaryWriterSession s = new XmlBinaryWriterSession ();
int idx;
s.TryAdd (d1, out idx);
s.TryAdd (d1, out idx);
}
示例14: CreateSerializer
internal static DataContractSerializer CreateSerializer(Type type, IList<Type> knownTypes, string rootName, string rootNs, int maxItems)
{
XmlDictionary dictionary = new XmlDictionary(2);
return new DataContractSerializer(
type,
dictionary.Add(rootName),
dictionary.Add(rootNs),
knownTypes);
}
示例15: DXD
static DXD()
{
XmlDictionary dictionary = new XmlDictionary(0x89);
atomicTransactionExternal11Dictionary = new System.ServiceModel.AtomicTransactionExternal11Dictionary(dictionary);
coordinationExternal11Dictionary = new System.ServiceModel.CoordinationExternal11Dictionary(dictionary);
secureConversationDec2005Dictionary = new System.ServiceModel.SecureConversationDec2005Dictionary(dictionary);
securityAlgorithmDec2005Dictionary = new System.ServiceModel.SecurityAlgorithmDec2005Dictionary(dictionary);
trustDec2005Dictionary = new System.ServiceModel.TrustDec2005Dictionary(dictionary);
wsrm11Dictionary = new System.ServiceModel.Wsrm11Dictionary(dictionary);
}