當前位置: 首頁>>代碼示例>>C#>>正文


C# XmlSerializerNamespaces.ToArray方法代碼示例

本文整理匯總了C#中System.Xml.Serialization.XmlSerializerNamespaces.ToArray方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlSerializerNamespaces.ToArray方法的具體用法?C# XmlSerializerNamespaces.ToArray怎麽用?C# XmlSerializerNamespaces.ToArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Xml.Serialization.XmlSerializerNamespaces的用法示例。


在下文中一共展示了XmlSerializerNamespaces.ToArray方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: XmlSerializerNamespaceResolver

		public XmlSerializerNamespaceResolver(XmlSerializerNamespaces serializerNamespaces) {
			serializerNamespaces.ToArray().ForEach(qns => {
				if (!qns.IsEmpty) {
					m_namespaces.Add(qns.Name, qns.Namespace);
				}
			});
		}
開發者ID:zzilla,項目名稱:ONVIF-Device-Manager,代碼行數:7,代碼來源:ObservableTraceListener.cs

示例2: Initialize

		internal void Initialize (XmlWriter writer, XmlSerializerNamespaces nss)
		{
			this.writer = writer;
			if (nss != null)
			{
				namespaces = new ArrayList ();
				foreach (XmlQualifiedName ns in nss.ToArray())
					if (ns.Name != "" && ns.Namespace != "")
						namespaces.Add (ns);
			}	
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:11,代碼來源:XmlSerializationWriter.cs

示例3: WriteStartElement

		protected void WriteStartElement (string name, string ns, Object o, bool writePrefixed, XmlSerializerNamespaces xmlns)
		{
			WriteStartElement (name, ns, o, writePrefixed, xmlns != null ? xmlns.ToArray () : null);
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:4,代碼來源:XmlSerializationWriter.cs

示例4: FromOpenSearchDescription

        //---------------------------------------------------------------------------------------------------------------------
        /// <summary>Creates an OpenSearchParameterValueSet instance based on the specified OpenSearch template and optional additional parameter information.</summary>
        /// <returns>A new OpenSearchParameterValueSet instance.</returns>
        /// <param name="template">An OpenSearch template URL.</param>
        /// <param name="origParams">An array of objects containing parameter information as defined by the OpenSearch Parameter extension.</returns>
        public static OpenSearchParameterValueSet FromOpenSearchDescription(string template, OpenSearchDescriptionUrlParameter[] origParams = null, XmlSerializerNamespaces namespaces = null)
        {
            OpenSearchParameterValueSet result = new OpenSearchParameterValueSet();

            Dictionary<string, OpenSearchDescriptionUrlParameter> tempParameters = new Dictionary<string, OpenSearchDescriptionUrlParameter>();
            Dictionary<string, string> tempNamespaces = null;
            if (origParams != null) {
                foreach (OpenSearchDescriptionUrlParameter origParam in origParams) tempParameters.Add(origParam.Name, origParam);
            }

            if (namespaces != null) {
                result.nameTable = new NameTable();
                tempNamespaces = new Dictionary<string, string>();
                foreach (XmlQualifiedName qn in namespaces.ToArray()) {
                    tempNamespaces.Add(qn.Name, result.nameTable.Add(qn.Namespace));
                }
            }

            // Make sure URL is valid
            Match match = urlRegex.Match(template);
            if (!match.Success) throw new OpenSearchException(String.Format("Invalid URL template: {0}", template));

            // Split by query string parameter and add parameter definitions to the internal dictionaries:
            // parameters can be settable (e.g. name={key}, name={prefix:key}) or fixed (name=value)
            string[] items = match.Groups[1].Value.Split('&');
            foreach (string item in items) {
                Match match2 = parameterDefinitionRegex.Match(item);
                if (!match2.Success) continue;
                string name = match2.Groups[1].Value;
                OpenSearchParameterDefinition paramDef;
                if (match2.Groups[3].Success) { // parameter is settable
                    string identifier = match2.Groups[3].Value;
                    string identifierNamespaceUri = null, identifierLocalName = null;
                    if (tempNamespaces != null) {
                        string[] parts = identifier.Split(':');
                        if (parts.Length == 2) {
                            identifierNamespaceUri = tempNamespaces.ContainsKey(parts[0]) ? tempNamespaces[parts[0]] : null;
                            if (identifierNamespaceUri != null) identifierLocalName = parts[1];
                        }
                    }
                    paramDef = new OpenSearchParameterDefinition(name, identifier, identifierNamespaceUri, identifierLocalName, tempParameters.ContainsKey(name) ? tempParameters[name] : null);
                    result.parametersByIdentifier[identifier] = paramDef;
                } else { // parameter is fixed
                    paramDef = new OpenSearchParameterDefinition(name);
                    result.values[paramDef] = new string[] {match2.Groups[2].Value};
                }
                result.parametersByName[paramDef.Name] = paramDef;
            }

            return result;
        }
開發者ID:Terradue,項目名稱:DotNetOpenSearch,代碼行數:56,代碼來源:OpenSearchParameterValueSet.cs

示例5: WriteStartElement

		protected void WriteStartElement (string name, string ns, Object o, bool writePrefixed, XmlSerializerNamespaces xmlns)
		{
			if (xmlns == null)
				throw new ArgumentNullException ("xmlns");
			WriteStartElement (name, ns, o, writePrefixed, xmlns.ToArray ());
		}
開發者ID:runefs,項目名稱:Marvin,代碼行數:6,代碼來源:XmlSerializationWriter.cs

示例6: XmlSerializerNamespaces

		public XmlSerializerNamespaces(XmlSerializerNamespaces namespaces)
			: this(namespaces.ToArray())
		{}
開發者ID:calumjiao,項目名稱:Mono-Class-Libraries,代碼行數:3,代碼來源:XmlSerializerNamespaces.cs

示例7: GetNamespace

 private String GetNamespace( XmlSerializerNamespaces namespaces )
 {
     var sb = new StringBuilder();
     foreach (XmlQualifiedName name in namespaces.ToArray())
     {
         sb.Append( name.Namespace );
     }
     return sb.ToString();
 }
開發者ID:UtrsSoftware,項目名稱:ATMLWorkBench,代碼行數:9,代碼來源:SchemaManager.cs

示例8: XmppSerializer

        /// <summary>
        ///   Initializes a new instance of the <see cref = "XmppSerializer" /> class.
        /// </summary>
        /// <param name = "elementName">Name of the element.</param>
        /// <param name = "schema">The schema.</param>
        /// <param name = "prefix">The prefix.</param>
        /// <param name = "defaultNamespace">The default namespace.</param>
        /// <param name = "serializerType">Type of the serializer.</param>
        private XmppSerializer(string elementName, string schema, string prefix, string defaultNamespace, Type serializerType)
        {
            this.elementName = elementName;
            this.serializerType = serializerType;
            this.schema = schema;
            this.prefix = prefix;
            this.defaultNamespace = defaultNamespace;
            serializer = new XmlSerializer(serializerType);
            nameTable = new NameTable();
            nsMgr = new XmlNamespaceManager(nameTable);
            context = new XmlParserContext(nameTable, nsMgr, null, XmlSpace.None);
            namespaces = new XmlSerializerNamespaces();
            namespaces.Add(prefix, defaultNamespace);

            foreach (XmlQualifiedName name in namespaces.ToArray())
            {
                nsMgr.AddNamespace(name.Name, name.Namespace);
            }
        }
開發者ID:tshwangq,項目名稱:Hanoi,代碼行數:27,代碼來源:XmppSerializer.cs


注:本文中的System.Xml.Serialization.XmlSerializerNamespaces.ToArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。