当前位置: 首页>>代码示例>>C#>>正文


C# XmlNode.GetNamespaceOfPrefix方法代码示例

本文整理汇总了C#中System.Xml.XmlNode.GetNamespaceOfPrefix方法的典型用法代码示例。如果您正苦于以下问题:C# XmlNode.GetNamespaceOfPrefix方法的具体用法?C# XmlNode.GetNamespaceOfPrefix怎么用?C# XmlNode.GetNamespaceOfPrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlNode的用法示例。


在下文中一共展示了XmlNode.GetNamespaceOfPrefix方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateManifest

		public static void UpdateManifest(string fullPath) {
			_document = new XmlDocument();
			_document.Load(fullPath);
			
			if (_document == null)
			{
				Debug.LogError("Couldn't load " + fullPath);
				return;
			}

			_manifestNode = FindChildNode(_document, "manifest");
			_namespace = _manifestNode.GetNamespaceOfPrefix("android");
			_applicationNode = FindChildNode(_manifestNode, "application");
			
			if (_applicationNode == null) {
				Debug.LogError("Error parsing " + fullPath);
				return;
			}

			SetPermission("android.permission.INTERNET");

			XmlElement applicationElement = FindChildElement(_manifestNode, "application");
			applicationElement.SetAttribute("name", _namespace, "com.soomla.SoomlaApp");


			foreach(ISoomlaManifestTools manifestTool in ManTools) {
				manifestTool.UpdateManifest();
			}
			
			_document.Save(fullPath);
		}
开发者ID:drapermovies,项目名称:MansionGamingGitHub,代码行数:31,代码来源:SoomlaManifestTools.cs

示例2: AddAttribute

 /// <summary>
 /// 添加节点属性
 /// </summary>
 /// <param name="xDoc">XmlDocument对象</param>
 /// <param name="node">节点对象</param>
 /// <param name="namespaceOfPrefix">该节点的命名空间URI</param>
 /// <param name="attributeName">新属性名称</param>
 /// <param name="attributeValue">属性值</param>
 public static void AddAttribute(XmlDocument xDoc, XmlNode node, string namespaceOfPrefix, string attributeName, string attributeValue)
 {
     string ns = namespaceOfPrefix == null ? null : node.GetNamespaceOfPrefix(namespaceOfPrefix);
     XmlNode xn = xDoc.CreateNode(XmlNodeType.Attribute, attributeName, ns == "" ? null : ns);
     xn.Value = attributeValue;
     node.Attributes.SetNamedItem(xn);
 }
开发者ID:refinedKing,项目名称:WeiXin--Vs2010-,代码行数:15,代码来源:XMLHelper.cs

示例3: LoadManifest

		private static void LoadManifest(){
			_document = new XmlDocument();
			_document.Load(outputFile);
			
			if (_document == null)
			{
				Debug.LogError("Couldn't load " + outputFile);
				return;
			}
			
			_manifestNode = FindChildNode(_document, "manifest");
			_namespace = _manifestNode.GetNamespaceOfPrefix("android");
			_applicationNode = FindChildNode(_manifestNode, "application");
			
			if (_applicationNode == null) {
				Debug.LogError("Error parsing " + outputFile);
				return;
			}
		}
开发者ID:Ratel13,项目名称:soomla-unity3d-core,代码行数:19,代码来源:SoomlaManifestTools.cs

示例4: FindTargetSchemaNode

 private static void FindTargetSchemaNode(XmlNode document, XmlNamespaceManager xmlNamespaceManager, XmlNode node, XmlNode thisSchemaNode, string rawTypeName, out XmlNode targetSchemaNode, out TypeReference typeReference)
 {
     string[] typeParts = rawTypeName.Split(':');
     string typeName;
     string typeTargetNamespace;
     if (typeParts.Length == 2)
     {
         typeTargetNamespace = node.GetNamespaceOfPrefix(typeParts[0]);
         typeName = typeParts[1];
         XmlNodeList targetSchemaNodes = document.SelectNodes(".//xs:schema[@targetNamespace='" + typeTargetNamespace + "']", xmlNamespaceManager);
         targetSchemaNode = targetSchemaNodes[0];
     }
     else if (typeParts.Length == 1)
     {
         typeTargetNamespace = thisSchemaNode.Attributes.GetNamedItem("targetNamespace").Value;
         typeName = typeParts[0];
         targetSchemaNode = thisSchemaNode;
     }
     else
     {
         throw new InvalidOperationException("Could not find target schema node for type " + rawTypeName + ".");
     }
     typeReference = new TypeReference(typeTargetNamespace, typeName);
 }
开发者ID:jam40jeff,项目名称:CsJs,代码行数:24,代码来源:XmlSchemaParser.cs

示例5: FindUnusedPrefix

        public static string FindUnusedPrefix(XmlNode node, string prefixHint)
        {
            string pp = prefixHint;
            if (prefixHint == null || prefixHint.Length == 0)
                pp = "n";
            else
            {
                string uri = node.GetNamespaceOfPrefix(pp);
                if (uri == null || uri.Length == 0)
                    return pp;
            }

            int n = 1;
            while (true)
            {
                string s = string.Format(pp+"{0}", n++);
                string uri = node.GetNamespaceOfPrefix(s);
                if (uri == null || uri.Length == 0)
                    return s;
            }
        }
开发者ID:Phil-Ruben,项目名称:Residuals,代码行数:21,代码来源:xmloperations.cs

示例6: CastToQName

        public static Altova.Types.QName CastToQName(XmlNode node, MemberInfo member)
        {
            int i = node.InnerText.IndexOf(":");
            if (i == -1)
                return new Altova.Types.QName(node.GetNamespaceOfPrefix(""), node.InnerText);

            string prefix = node.InnerText.Substring(0, i);
            string local = node.InnerText.Substring(i + 1);

            string uri = node.GetNamespaceOfPrefix(prefix);

            return new Altova.Types.QName(uri, prefix, local);
        }
开发者ID:Phil-Ruben,项目名称:Residuals,代码行数:13,代码来源:xmloperations.cs

示例7: WriteNamespacesAxis

		// Namespace Axis
		// Consider a list L containing only namespace nodes in the 
		// axis and in the node-set in lexicographic order (ascending). To begin 
		// processing L, if the first node is not the default namespace node (a node 
		// with no namespace URI and no local name), then generate a space followed 
		// by xmlns="" if and only if the following conditions are met:
		//    - the element E that owns the axis is in the node-set
		//    - The nearest ancestor element of E in the node-set has a default 
		//	    namespace node in the node-set (default namespace nodes always 
		//      have non-empty values in XPath)
		// The latter condition eliminates unnecessary occurrences of xmlns="" in 
		// the canonical form since an element only receives an xmlns="" if its 
		// default namespace is empty and if it has an immediate parent in the 
		// canonical form that has a non-empty default namespace. To finish 
		// processing  L, simply process every namespace node in L, except omit 
		// namespace node with local name xml, which defines the xml prefix, 
		// if its string value is http://www.w3.org/XML/1998/namespace.
		private void WriteNamespacesAxis (XmlNode node, bool visible)
		{
			// Console.WriteLine ("Debug: namespaces");

			XmlDocument doc = node.OwnerDocument;    
			bool has_empty_namespace = false;
			ArrayList list = new ArrayList ();
			for (XmlNode cur = node; cur != null && cur != doc; cur = cur.ParentNode) {
			        foreach (XmlNode attribute in cur.Attributes) {		
					if (!IsNamespaceNode (attribute)) 
			    			continue;
			    	
					// get namespace prefix
					string prefix = string.Empty;
					if (attribute.Prefix == "xmlns") 
						prefix = attribute.LocalName;
			    
				        // check if it is "xml" namespace			    
					if (prefix == "xml" && attribute.Value == "http://www.w3.org/XML/1998/namespace")
						continue;
			    
					// make sure that this is an active namespace
					// for our node
					string ns = node.GetNamespaceOfPrefix (prefix);
					if (ns != attribute.Value) 
						continue;
			    
					// check that it is selected with XPath
					if (!IsNodeVisible (attribute)) 
						continue;

					// check that we have not rendered it yet
					bool rendered = IsNamespaceRendered (prefix, attribute.Value);

					// add to the visible namespaces stack
					if (visible)
						visibleNamespaces.Add (attribute);			      
			    
					if (!rendered)
						list.Add (attribute);
				    
					if (prefix == string.Empty)
						has_empty_namespace = true;
				}
			}

			// add empty namespace if needed		    
			if (visible && !has_empty_namespace && !IsNamespaceRendered (string.Empty, string.Empty)) 
				res.Append (" xmlns=\"\"");
		    
			list.Sort (new XmlDsigC14NTransformNamespacesComparer ());
			foreach (object obj in list) {
				XmlNode attribute = (obj as XmlNode);
				if (attribute != null) {
					res.Append (" ");
					res.Append (attribute.Name);
					res.Append ("=\"");
					res.Append (attribute.Value);
					res.Append ("\"");
				}
			}
		    
			// move the rendered namespaces stack
			if (visible) {
				prevVisibleNamespacesStart = prevVisibleNamespacesEnd;
				prevVisibleNamespacesEnd = visibleNamespaces.Count;	
			}
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:85,代码来源:XmlCanonicalizer.cs

示例8: TryFindElementWithAndroidName

        private static bool TryFindElementWithAndroidName(
            XmlNode parent,
            string attrNameValue,
            out XmlElement element,
            string elementType = "activity")
        {
            string ns = parent.GetNamespaceOfPrefix("android");
            var curr = parent.FirstChild;
            while (curr != null)
            {
                var currXmlElement = curr as XmlElement;
                if (currXmlElement != null &&
                    currXmlElement.Name == elementType &&
                    currXmlElement.GetAttribute("name", ns) == attrNameValue)
                {
                    element = currXmlElement;
                    return true;
                }

                curr = curr.NextSibling;
            }

            element = null;
            return false;
        }
开发者ID:CenzyGames,项目名称:Meal-Steal,代码行数:25,代码来源:ManifestMod.cs

示例9: GetTypeQualifiedName

		void GetTypeQualifiedName (XmlNode node, string qualifiedName, out string name, out string ns)
		{
			int i = qualifiedName.IndexOf (':');
			if (i == -1)
			{
				name = qualifiedName;
				ns = "";
				return;
			}
			
			string prefix = qualifiedName.Substring (0,i);
			name = qualifiedName.Substring (i+1);
			ns = node.GetNamespaceOfPrefix (prefix);
			
			string arrayType = GetArrayType (node, name, ns);
			if (arrayType != null) {
				name = arrayType;
				ns = "";
			}
			else if (ns != MetaData.SchemaNamespace) {
				ns = DecodeNamespace (ns);
			}
			else {
				ns = "";
				name = GetClrFromXsd (name);
			}
		}
开发者ID:nlhepler,项目名称:mono,代码行数:27,代码来源:MetaDataCodeGenerator.cs

示例10: ParseName

 public static XmlName ParseName(XmlNode context, string name, XmlNodeType nt)
 {
     XmlName result = new XmlName();
     XmlConvert.VerifyName(name);
     int i = name.IndexOf(':');
     if (i>0){
         string prefix = result.Prefix = name.Substring(0,i);
         result.LocalName = name.Substring(i + 1);
         if (prefix == "xml") {
             result.NamespaceUri = XmlUri;
         } else if (prefix == "xmlns") {
             result.NamespaceUri = XmlnsUri;
         } else {
             result.NamespaceUri = context.GetNamespaceOfPrefix(prefix);
         }
     } else {
         result.Prefix = "";
         result.LocalName = name;
         if (name == "xmlns") {
             result.NamespaceUri = XmlnsUri;
         } else if (nt == XmlNodeType.Attribute) {
             result.NamespaceUri = ""; // non-prefixed attributes are empty namespace by definition
         } else {
             result.NamespaceUri = context.GetNamespaceOfPrefix("");
         }
     }
     return result;
 }
开发者ID:ic014308,项目名称:xml-notepad-for-mono,代码行数:28,代码来源:Commands.cs

示例11: SetXmlAttrValue

 /// <summary>
 /// ����ָ���ڵ���ָ�����Ե�ֵ
 /// </summary>
 /// <param name="clsXmlNode">XML�ڵ�</param>
 /// <param name="szPrefix">���Ե�ǰ׺</param>
 /// <param name="szAttrName">������</param>
 /// <param name="szAttrValue">����ֵ</param>
 /// <returns>bool</returns>
 public static bool SetXmlAttrValue(XmlNode clsXmlNode, string szPrefix, string szAttrName, string szAttrValue)
 {
     if (clsXmlNode == null)
         return false;
     XmlDocument clsXmlDoc = clsXmlNode.OwnerDocument;
     if (clsXmlDoc == null)
         return false;
     if (szAttrName == null || szAttrName.Trim() == "")
         return false;
     if (szAttrValue == null)
         szAttrValue = string.Empty;
     try
     {
         XmlAttribute clsAttrNode = clsXmlNode.Attributes.GetNamedItem(szAttrName) as XmlAttribute;
         if (clsAttrNode == null)
         {
             string szNamespaceUri = null;
             if (szPrefix == "xmlns")
                 szNamespaceUri = "http://www.w3.org/2000/xmlns/";
             else if (!GlobalMethods.Misc.IsEmptyString(szPrefix))
                 szNamespaceUri = clsXmlNode.GetNamespaceOfPrefix(szPrefix);
             clsAttrNode = clsXmlDoc.CreateAttribute(szPrefix, szAttrName, szNamespaceUri);
             clsXmlNode.Attributes.Append(clsAttrNode);
         }
         clsAttrNode.InnerText = szAttrValue;
         return true;
     }
     catch (Exception ex)
     {
         LogManager.Instance.WriteLog("GlobalMethods.SetXmlAttrValue"
            , new string[] { "clsXmlNode", "szPrefix", "szAttrName", "szAttrValue" }
             , new object[] { clsXmlNode, szPrefix, szAttrName, szAttrValue }, "�޷�����XML�ڵ������ֵ!", ex);
         return false;
     }
 }
开发者ID:zuifengke,项目名称:windy-common,代码行数:43,代码来源:Xml.cs


注:本文中的System.Xml.XmlNode.GetNamespaceOfPrefix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。