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


C# XPathNode类代码示例

本文整理汇总了C#中XPathNode的典型用法代码示例。如果您正苦于以下问题:C# XPathNode类的具体用法?C# XPathNode怎么用?C# XPathNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: GetInScopeNamespaces

        /// <summary>
        /// Return chain of in-scope namespace nodes for nodes of type Element.  Nodes in the chain might not
        /// have this element as their parent.  Since the xmlns:xml namespace node is always in scope, this
        /// method will never return 0 if the specified node is an element.
        /// </summary>
        public static int GetInScopeNamespaces(XPathNode[] pageElem, int idxElem, out XPathNode[] pageNmsp)
        {
            XPathDocument doc;

            // Only elements have namespace nodes
            if (pageElem[idxElem].NodeType == XPathNodeType.Element)
            {
                doc = pageElem[idxElem].Document;

                // Walk ancestors, looking for an ancestor that has at least one namespace declaration
                while (!pageElem[idxElem].HasNamespaceDecls)
                {
                    idxElem = pageElem[idxElem].GetParent(out pageElem);
                    if (idxElem == 0)
                    {
                        // There are no namespace nodes declared on ancestors, so return xmlns:xml node
                        return doc.GetXmlNamespaceNode(out pageNmsp);
                    }
                }
                // Return chain of in-scope namespace nodes
                return doc.LookupNamespaces(pageElem, idxElem, out pageNmsp);
            }
            pageNmsp = null;
            return 0;
        }
开发者ID:Corillian,项目名称:corefx,代码行数:30,代码来源:XPathNodeHelper.cs

示例2: XPathDocumentNavigator

 public XPathDocumentNavigator(XPathNode[] pageCurrent, int idxCurrent, XPathNode[] pageParent, int idxParent)
 {
     this.pageCurrent = pageCurrent;
     this.pageParent = pageParent;
     this.idxCurrent = idxCurrent;
     this.idxParent = idxParent;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:XPathDocumentNavigator.cs

示例3: XPathDocumentNavigator

        //-----------------------------------------------
        // Constructors
        //-----------------------------------------------

        /// <summary>
        /// Create a new navigator positioned on the specified current node.  If the current node is a namespace or a collapsed
        /// text node, then the parent is a virtualized parent (may be different than .Parent on the current node).
        /// </summary>
        public XPathDocumentNavigator(XPathNode[] pageCurrent, int idxCurrent, XPathNode[] pageParent, int idxParent) {
            Debug.Assert(pageCurrent != null && idxCurrent != 0);
            Debug.Assert((pageParent == null) == (idxParent == 0));
            this.pageCurrent = pageCurrent;
            this.pageParent = pageParent;
            this.idxCurrent = idxCurrent;
            this.idxParent = idxParent;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:16,代码来源:XPathDocumentNavigator.cs

示例4: GetLocalNamespaces

 /// <summary>
 /// Return chain of namespace nodes.  If specified node has no local namespaces, then 0 will be
 /// returned.  Otherwise, the first node in the chain is guaranteed to be a local namespace (its
 /// parent is this node).  Subsequent nodes may not have the same node as parent, so the caller will
 /// need to test the parent in order to terminate a search that processes only local namespaces.
 /// </summary>
 public static int GetLocalNamespaces(XPathNode[] pageElem, int idxElem, out XPathNode[] pageNmsp) {
     if (pageElem[idxElem].HasNamespaceDecls) {
         // Only elements have namespace nodes
         Debug.Assert(pageElem[idxElem].NodeType == XPathNodeType.Element);
         return pageElem[idxElem].Document.LookupNamespaces(pageElem, idxElem, out pageNmsp);
     }
     pageNmsp = null;
     return 0;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:15,代码来源:XPathNodeHelper.cs

示例5: GetFirstAttribute

        /// <summary>
        /// Return the first attribute of the specified node.  If no attribute exist, do not
        /// set pageNode or idxNode and return false.
        /// </summary>
        public static bool GetFirstAttribute(ref XPathNode[] pageNode, ref int idxNode) {
            Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");

            if (pageNode[idxNode].HasAttribute) {
                GetChild(ref pageNode, ref idxNode);
                Debug.Assert(pageNode[idxNode].NodeType == XPathNodeType.Attribute);
                return true;
            }
            return false;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:14,代码来源:XPathNodeHelper.cs

示例6: GetNextAttribute

        /// <summary>
        /// Return the next attribute sibling of the specified node.  If the node is not itself an
        /// attribute, or if there are no siblings, then do not set pageNode or idxNode and return false.
        /// </summary>
        public static bool GetNextAttribute(ref XPathNode[] pageNode, ref int idxNode) {
            XPathNode[] page;
            int idx;
            Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");

            idx = pageNode[idxNode].GetSibling(out page);
            if (idx != 0 && page[idx].NodeType == XPathNodeType.Attribute) {
                pageNode = page;
                idxNode = idx;
                return true;
            }
            return false;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:17,代码来源:XPathNodeHelper.cs

示例7: Create

 public XPathNodeInfoAtom Create(string localName, string namespaceUri, string prefix, string baseUri, XPathNode[] pageParent, XPathNode[] pageSibling, XPathNode[] pageSimilar, XPathDocument doc, int lineNumBase, int linePosBase)
 {
     XPathNodeInfoAtom infoCached;
     if (this.infoCached == null)
     {
         infoCached = new XPathNodeInfoAtom(localName, namespaceUri, prefix, baseUri, pageParent, pageSibling, pageSimilar, doc, lineNumBase, linePosBase);
     }
     else
     {
         infoCached = this.infoCached;
         this.infoCached = infoCached.Next;
         infoCached.Init(localName, namespaceUri, prefix, baseUri, pageParent, pageSibling, pageSimilar, doc, lineNumBase, linePosBase);
     }
     return this.Atomize(infoCached);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:XPathNodeInfoTable.cs

示例8: GetFollowingEnd

 private int GetFollowingEnd(XPathDocumentNavigator end, bool useParentOfVirtual, out XPathNode[] pageEnd)
 {
     if ((end != null) && (this.pageCurrent[this.idxCurrent].Document == end.pageCurrent[end.idxCurrent].Document))
     {
         if (end.idxParent == 0)
         {
             pageEnd = end.pageCurrent;
             return end.idxCurrent;
         }
         pageEnd = end.pageParent;
         if (!useParentOfVirtual)
         {
             return (end.idxParent + 1);
         }
         return end.idxParent;
     }
     pageEnd = null;
     return 0;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:19,代码来源:XPathDocumentNavigator.cs

示例9: Init

 public void Init(string localName, string namespaceUri, string prefix, string baseUri, XPathNode[] pageParent, XPathNode[] pageSibling, XPathNode[] pageSimilar, XPathDocument doc, int lineNumBase, int linePosBase)
 {
     this.localName = localName;
     this.namespaceUri = namespaceUri;
     this.prefix = prefix;
     this.baseUri = baseUri;
     this.pageParent = pageParent;
     this.pageSibling = pageSibling;
     this.pageSimilar = pageSimilar;
     this.doc = doc;
     this.lineNumBase = lineNumBase;
     this.linePosBase = linePosBase;
     this.next = null;
     this.pageInfo = null;
     this.hashCode = 0;
     this.localNameHash = 0;
     for (int i = 0; i < this.localName.Length; i++)
     {
         this.localNameHash += (this.localNameHash << 7) ^ this.localName[i];
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:21,代码来源:XPathNodeInfoAtom.cs

示例10: SetRootNode

 internal void SetRootNode(XPathNode[] pageRoot, int idxRoot)
 {
     this.pageRoot = pageRoot;
     this.idxRoot = idxRoot;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:5,代码来源:XPathDocument.cs

示例11: SetCollapsedTextNode

 internal void SetCollapsedTextNode(XPathNode[] pageText, int idxText)
 {
     this.pageText = pageText;
     this.idxText = idxText;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:5,代码来源:XPathDocument.cs

示例12: XPathNodePageInfo

 /// <summary>
 /// Constructor.
 /// </summary>
 public XPathNodePageInfo(XPathNode[] pagePrev, int pageNum) {
     this.pagePrev = pagePrev;
     this.pageNum = pageNum;
     this.nodeCount = 1;         // Every node page contains PageInfo at 0th position
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:8,代码来源:XPathNodeInfoAtom.cs

示例13: GetFollowingEnd

        /// <summary>
        /// "end" is positioned on a node which terminates a following scan.  Return the page and index of "end" if it
        /// is positioned to a non-virtual node.  If "end" is positioned to a virtual node:
        ///    1. If useParentOfVirtual is true, then return the page and index of the virtual node's parent
        ///    2. If useParentOfVirtual is false, then return the page and index of the virtual node's parent + 1.
        /// </summary>
        private int GetFollowingEnd(XPathDocumentNavigator end, bool useParentOfVirtual, out XPathNode[] pageEnd)
        {
            // If ending navigator is positioned to a node in another document, then return null
            if (end != null && _pageCurrent[_idxCurrent].Document == end._pageCurrent[end._idxCurrent].Document)
            {
                // If the ending navigator is not positioned on a virtual node, then return its current node
                if (end._idxParent == 0)
                {
                    pageEnd = end._pageCurrent;
                    return end._idxCurrent;
                }

                // If the ending navigator is positioned on an attribute, namespace, or virtual text node, then use the
                // next physical node instead, as the results will be the same.
                pageEnd = end._pageParent;
                return (useParentOfVirtual) ? end._idxParent : end._idxParent + 1;
            }

            // No following, so set pageEnd to null and return an index of 0
            pageEnd = null;
            return 0;
        }
开发者ID:svcgany1,项目名称:corefx,代码行数:28,代码来源:XPathDocumentNavigator.cs

示例14: SetXmlNamespaceNode

 internal void SetXmlNamespaceNode(XPathNode[] pageXmlNmsp, int idxXmlNmsp)
 {
     this.pageXmlNmsp = pageXmlNmsp;
     this.idxXmlNmsp = idxXmlNmsp;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:5,代码来源:XPathDocument.cs

示例15: GetChild

        /// <summary>
        /// Return the page and index of the first child (attribute or content) of the specified node.
        /// </summary>
        private static void GetChild(ref XPathNode[] pageNode, ref int idxNode) {
            Debug.Assert(pageNode[idxNode].HasAttribute || pageNode[idxNode].HasContentChild, "Caller must check HasAttribute/HasContentChild on parent before calling GetChild.");
            Debug.Assert(pageNode[idxNode].HasAttribute || !pageNode[idxNode].HasCollapsedText, "Text child is virtualized and therefore is not present in the physical node page.");

            if (++idxNode >= pageNode.Length) {
                // Child is first node on next page
                pageNode = pageNode[0].PageInfo.NextPage;
                idxNode = 1;
            }
            // Else child is next node on this page
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:14,代码来源:XPathNodeHelper.cs


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