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


C# XPathNavigator.LookupNamespace方法代碼示例

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


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

示例1: FnResolveQName

		// FIXME: add a bunch of annoying datetime functions

		public static object FnResolveQName (string qname, XPathNavigator element)
		{
			if (qname == null)
				return null;

			int index = qname.IndexOf (':');
			string prefix = (index < 0) ? "" : qname.Substring (index);
			return new XmlQualifiedName (
				element.LookupNamespace (prefix),
				index < 0 ? qname : qname.Substring (index + 1));
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:13,代碼來源:XQueryFunctionCliImpl.cs

示例2: MSNamespaceUri

        public static string MSNamespaceUri(string name, XPathNavigator currentNode) {
            int colonOffset;
            int len = ValidateNames.ParseQName(name, 0, out colonOffset);

            if (len != name.Length) {
                return string.Empty;
            }
            string prefix = name.Substring(0, colonOffset);
            if (prefix == "xmlns") {
                return string.Empty;
            }
            string ns = currentNode.LookupNamespace(prefix);
            if (ns != null) {
                return ns;
            }
            if (prefix == "xml") {
                return XmlReservedNs.NsXml;
            }
            return string.Empty;
        }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:20,代碼來源:XsltFunctions.cs

示例3: ReadXml

        public void ReadXml(XPathNavigator node, XmlResolver resolver)
        {
            if (node.NodeType == XPathNodeType.Element) {

            XPathNavigator el = node.Clone();

            if (node.MoveToFirstAttribute()) {

               do {
                  switch (node.LocalName) {
                     case "byte-order-mark":
                        this.ByteOrderMark = node.ValueAsBoolean;
                        break;

                     case "doctype-public":
                        this.DocTypePublic = node.Value;
                        break;

                     case "doctype-system":
                        this.DocTypeSystem = node.Value;
                        break;

                     case "encoding":
                        this.Encoding = Encoding.GetEncoding(node.Value);
                        break;

                     case "indent":
                        this.Indent = node.ValueAsBoolean;
                        break;

                     case "media-type":
                        this.MediaType = node.Value;
                        break;

                     case "method":

                        if (node.Value.Contains(":")) {

                           string name = XmlConvert.VerifyName(node.Value);
                           string[] parts = name.Split(':');

                           string local = parts[1];
                           string ns = node.LookupNamespace(parts[0]) ?? "";

                           XmlQualifiedName qname = new XmlQualifiedName(local, ns);

                           if (ns != null
                              && (qname == ExtensionMethods.Base64Binary
                                 || qname == ExtensionMethods.HexBinary)) {
                              this.Method = qname;
                           } else {
                              throw new ArgumentException("The value of the method attribute must be one of: xml, html, xhtml, text, http:base64Binary or http:hexBinary.", "node");
                           }

                        } else {

                           switch (node.Value) {
                              case "xml":
                                 this.Method = XPathSerializationMethods.Xml;
                                 break;

                              case "html":
                                 this.Method = XPathSerializationMethods.Html;
                                 break;

                              case "xhtml":
                                 this.Method = XPathSerializationMethods.XHtml;
                                 break;

                              case "text":
                                 this.Method = XPathSerializationMethods.Text;
                                 break;

                              default:
                                 throw new ArgumentException("The value of the method attribute must be one of: xml, html, xhtml, text, http:base64Binary or http:hexBinary.", "node");
                           }
                        }
                        break;

                     case "omit-xml-declaration":
                        this.OmitXmlDeclaration = node.ValueAsBoolean;
                        break;

                     case "src":

                        Uri elBaseUri = !String.IsNullOrEmpty(el.BaseURI) ?
                           new Uri(el.BaseURI) :
                           null;

                        if (resolver != null) {
                           this.Src = resolver.ResolveUri(elBaseUri, node.Value);
                        } else {
                           this.Src = (elBaseUri != null) ?
                              new Uri(elBaseUri, node.Value) :
                              new Uri(node.Value);
                        }

                        break;

                     default:
//.........這裏部分代碼省略.........
開發者ID:skurdiukov,項目名稱:myxsl,代碼行數:101,代碼來源:XPathHttpBody.cs

示例4: resolveNsPrefix

 /// <summary>
 /// This method resolves the prefix of an argument.
 /// If a prefix is found, the corresponding namespace URI (if existing) is looked up 
 /// and substituted. Otherwise the target namespace is placed first.
 /// </summary>
 /// <param name="args">An argument of the function to be resolved</param>
 /// <param name="xsltContext">The Xslt context for namespace resolving</param>
 private string resolveNsPrefix(string args, string targetNs, XPathNavigator docContext)
 {
     string prefix;
     string ns;
     if (args.Contains(":"))
     {
         prefix = args.Substring(0, args.IndexOf(":"));
         if (!string.IsNullOrEmpty((ns = docContext.LookupNamespace(prefix))))
             return args = args.Replace(prefix + ":", ns);
         return targetNs + args;
     }
     return targetNs + args;
 }
開發者ID:HackatonArGP,項目名稱:Guardianes,代碼行數:20,代碼來源:XPathQueryManager.cs

示例5: ResolveNsPrefix

 /// <summary>
 /// This method resolves the prefix of an argument.
 /// If a prefix is found, the corresponding namespace URI (if existing) is looked up 
 /// and substituted. Otherwise the target namespace is placed first.
 /// </summary>
 /// <param name="args">An argument of the function to be resolved</param>
 /// <param name="targetNs">The target namespace</param>
 /// <param name="docContext">The document context</param>
 private static string ResolveNsPrefix(string args, string targetNs, XPathNavigator docContext)
 {
     if (args.Contains(":"))
     {
         var prefix = args.Substring(0, args.IndexOf(":", StringComparison.Ordinal));
         string ns;
         if (!string.IsNullOrEmpty((ns = docContext.LookupNamespace(prefix))))
             return args.Replace(prefix + ":", ns);
         return targetNs + args;
     }
     return targetNs + args;
 }
開發者ID:geobabbler,項目名稱:SharpMap,代碼行數:20,代碼來源:XPathQueryManager.cs


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