当前位置: 首页>>代码示例>>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;未经允许,请勿转载。