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


C# XPathDocument.SetCollapsedTextNode方法代码示例

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


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

示例1: Initialize

        /// <summary>
        /// Start construction of a new document.  This must be called before any other methods are called.
        /// It may also be called after Close(), in order to build further documents.
        /// </summary>
        public void Initialize(XPathDocument doc, IXmlLineInfo lineInfo, string baseUri, XPathDocument.LoadFlags flags)
        {
            XPathNode[] page;
            int idx;

            _doc = doc;
            _nameTable = doc.NameTable;
            _atomizeNames = (flags & XPathDocument.LoadFlags.AtomizeNames) != 0;
            _idxParent = _idxSibling = 0;
            _elemNameIndex = new XPathNodeRef[ElementIndexSize];

            // Prepare line number information
            _textBldr.Initialize(lineInfo);
            _lineInfo = lineInfo;
            _lineNumBase = 0;
            _linePosBase = 0;

            // Allocate the atomization table
            _infoTable = new XPathNodeInfoTable();

            // Allocate singleton collapsed text node
            idx = NewNode(out page, XPathNodeType.Text, string.Empty, string.Empty, string.Empty, string.Empty);
            _doc.SetCollapsedTextNode(page, idx);

            // Allocate xmlns:xml namespace node
            _idxNmsp = NewNamespaceNode(out _pageNmsp, _nameTable.Add("xml"), _nameTable.Add(XmlReservedNs.NsXml), null, 0);
            _doc.SetXmlNamespaceNode(_pageNmsp, _idxNmsp);

            if ((flags & XPathDocument.LoadFlags.Fragment) == 0)
            {
                // This tree has a document root node
                _idxParent = NewNode(out _pageParent, XPathNodeType.Root, string.Empty, string.Empty, string.Empty, baseUri);
                _doc.SetRootNode(_pageParent, _idxParent);
            }
            else
            {
                // This tree is an XQuery fragment (no document root node), so root will be next node in the current page
                _doc.SetRootNode(_nodePageFact.NextNodePage, _nodePageFact.NextNodeIndex);
            }
        }
开发者ID:Corillian,项目名称:corefx,代码行数:44,代码来源:XPathDocumentBuilder.cs


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