• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# XPathNamespaceScope类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: MoveToFirstNamespace

        //Caller( DataDocumentXPathNavigator will make sure that the node is at the right position for this call )
        internal bool MoveToFirstNamespace(XPathNamespaceScope namespaceScope) {
            //Debug.WriteLineIf( XmlTrace.traceXPathNodePointerFunctions.Enabled, "XPathNodePointer:MoveToFirstNamespace(namespaceScope)");
            RealFoliate();
            _parentOfNS = this._node as XmlBoundElement;
            //only need to check with _node, even if _column is not null and its mapping type is element, it can't have attributes
            if ( _parentOfNS == null )
                return false; 
            XmlNode node = this._node;
            XmlBoundElement be = null;
            while ( node != null ) {
                be = node as XmlBoundElement;
                if ( MoveToNextNamespace( be, null, null ) )
                    return true;
                //didn't find it
                if ( namespaceScope == XPathNamespaceScope.Local )
                    goto labelNoNS;
                //try the next element anccestor.
                do {
                    node = node.ParentNode;
                } while ( node != null && node.NodeType != XmlNodeType.Element );
            }
            if ( namespaceScope == XPathNamespaceScope.All ) {
                MoveTo( this._doc.attrXml, null, false );
                return true;
            }
labelNoNS:
            //didn't find one namespace node
            _parentOfNS = null;
            return false;
        }
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:31,代码来源:XPathNodePointer.cs


示例2: MoveToNextNamespace

 public override bool MoveToNextNamespace(XPathNamespaceScope namespaceScope)
 {
     this.currentPosition = -1L;
     return this.navigator.MoveToNextNamespace(namespaceScope);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:5,代码来源:GenericSeekableNavigator.cs


示例3: MoveToFirstNamespace

 public override bool MoveToFirstNamespace(XPathNamespaceScope scope)
 {
     XmlElement element = _source as XmlElement;
     if (element == null)
     {
         return false;
     }
     XmlAttributeCollection attributes;
     int index = Int32.MaxValue;
     switch (scope)
     {
         case XPathNamespaceScope.Local:
             if (!element.HasAttributes)
             {
                 return false;
             }
             attributes = element.Attributes;
             if (!MoveToFirstNamespaceLocal(attributes, ref index))
             {
                 return false;
             }
             _source = attributes[index];
             _attributeIndex = index;
             _namespaceParent = element;
             break;
         case XPathNamespaceScope.ExcludeXml:
             attributes = element.Attributes;
             if (!MoveToFirstNamespaceGlobal(ref attributes, ref index, element))
             {
                 return false;
             }
             XmlAttribute attribute = attributes[index];
             while (Ref.Equal(attribute.LocalName, XmlConst.NsXml))
             {
                 if (!MoveToNextNamespaceGlobal(ref attributes, ref index, element))
                 {
                     return false;
                 }
                 attribute = attributes[index];
             }
             _source = attribute;
             _attributeIndex = index;
             _namespaceParent = element;
             break;
         case XPathNamespaceScope.All:
             attributes = element.Attributes;
             if (!MoveToFirstNamespaceGlobal(ref attributes, ref index, element))
             {
                 _source = _document.GetNamespaceXml();
                 // attributeIndex = 0;
             }
             else
             {
                 _source = attributes[index];
                 _attributeIndex = index;
             }
             _namespaceParent = element;
             break;
         default:
             Debug.Assert(false);
             return false;
     }
     return true;
 }
开发者ID:svcgany1,项目名称:corefx,代码行数:64,代码来源:DocumentXPathNavigator.cs


示例4: MoveToFirstNamespace

 public override bool MoveToFirstNamespace(XPathNamespaceScope namespaceScope)
 {
     this.IncrementNodeCount();
     return this.navigator.MoveToFirstNamespace(namespaceScope);
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:5,代码来源:QuerySafeNavigator.cs


示例5: MoveToNextNamespace

 public override bool MoveToNextNamespace(XPathNamespaceScope scope)
 {
     return false;
 }
开发者ID:Corillian,项目名称:corefx,代码行数:4,代码来源:XPathNavigatorReader.cs


示例6: MoveToFirstNamespace

		public override bool MoveToFirstNamespace (
			XPathNamespaceScope namespaceScope)
		{
			if (!currentIsNode)
				return false;
			int cur = nodes [currentNode].FirstNamespace;
			return moveToSpecifiedNamespace (cur, namespaceScope);
		}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:8,代码来源:DTMXPathNavigator.cs


示例7: MoveToFirstNamespace

		public override bool MoveToFirstNamespace(XPathNamespaceScope namespaceScope)
		{

			//StreamUtil.WriteText("I:\\debug.txt","进到 MoveToFirstNamespace()\r\n");

            if (!(this.m_navigatorState.CurItem is ElementItem))
				return false;

            ElementItem element = (ElementItem)this.m_navigatorState.CurItem;

			ItemList namespaceList = element.NamespaceList;
			if (namespaceList.Count > 0)
			{
                this.m_navigatorState.CurItem = namespaceList[0];
				return true;
			}

			return false;
		}
开发者ID:renyh1013,项目名称:dp2,代码行数:19,代码来源:XmlEditorNavigator.cs


示例8: MoveToNextNamespace

		public override bool MoveToNextNamespace(XPathNamespaceScope namespaceScope)
		{
			//StreamUtil.WriteText("I:\\debug.txt","进到 MoveToNextNamespace()\r\n");
            Debug.Assert(this.m_navigatorState.CurItem != null, "");


            if (this.m_navigatorState.CurItem == this.m_navigatorState.VirtualRoot)
				return false;

            if (!(this.m_navigatorState.CurItem is AttrItem))
				return false;

            AttrItem attr = (AttrItem)this.m_navigatorState.CurItem;

			if (attr.IsNamespace == false)
				return false;

			ElementItem element = (ElementItem)attr.parent;

			ItemList namespaceList = element.NamespaceList;
			if (namespaceList.Count > 0)
			{
                int nIndex = namespaceList.IndexOf(this.m_navigatorState.CurItem);
				if (nIndex == -1)
					return false;
				if (nIndex + 1 >= namespaceList.Count)
					return false;

                this.m_navigatorState.CurItem = namespaceList[nIndex + 1];
				return true;
			}

			return false;
		}
开发者ID:renyh1013,项目名称:dp2,代码行数:34,代码来源:XmlEditorNavigator.cs


示例9: CopyNamespaces

        /// <summary>
        /// Copy all or some (which depends on nsScope) of the namespaces on the navigator's current node to the
        /// raw writer.
        /// </summary>
        private void CopyNamespaces(XPathNavigator nav, XPathNamespaceScope nsScope) {
            string prefix = nav.LocalName;
            string ns = nav.Value;

            if (nav.MoveToNextNamespace(nsScope)) {
                CopyNamespaces(nav, nsScope);
            }

            this.xwrt.WriteNamespaceDeclaration(prefix, ns);
        }
开发者ID:uQr,项目名称:referencesource,代码行数:14,代码来源:XmlSequenceWriter.cs


示例10: MoveToFirstNamespace

 public override bool MoveToFirstNamespace(XPathNamespaceScope namespaceScope)
 {
     return false;
 }
开发者ID:nuxleus,项目名称:flexwikicore,代码行数:4,代码来源:WomXPathNavigator.cs


示例11: CopyNamespacesHelper

        /// <summary>
        /// Recursive helper function that reverses order of the namespaces retrieved by MoveToFirstNamespace and
        /// MoveToNextNamespace.
        /// </summary>
        private void CopyNamespacesHelper(XPathNavigator navigator, XPathNamespaceScope nsScope) {
            string prefix = navigator.LocalName;
            string ns = navigator.Value;

            if (navigator.MoveToNextNamespace(nsScope))
                CopyNamespacesHelper(navigator, nsScope);

            // No possibility for conflict, since we're copying namespaces from well-formed element
            WriteNamespaceDeclarationUnchecked(prefix, ns);
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:14,代码来源:XmlQueryOutput.cs


示例12: CopyNamespaces

        /// <summary>
        /// Copy all namespaces of the specified type (in-scope, exclude-xml, local) in document order to output.
        /// </summary>
        private void CopyNamespaces(XPathNavigator navigator, XPathNamespaceScope nsScope) {
            Debug.Assert(navigator.NodeType == XPathNodeType.Element, "Only elements have namespaces to copy");

            // Default namespace undeclaration isn't included in navigator's namespace list, so add it now
            if (navigator.NamespaceURI.Length == 0) {
                Debug.Assert(navigator.LocalName.Length != 0, "xmlns:foo='' isn't allowed");
                WriteNamespaceDeclarationUnchecked(string.Empty, string.Empty);
            }

            // Since the namespace list is arranged in reverse-document order, recursively reverse it.
            if (navigator.MoveToFirstNamespace(nsScope)) {
                CopyNamespacesHelper(navigator, nsScope);
                navigator.MoveToParent();
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:18,代码来源:XmlQueryOutput.cs


示例13: MoveToNextNamespace

 //Caller( DataDocumentXPathNavigator will make sure that the node is at the right position for this call )
 internal bool MoveToNextNamespace(XPathNamespaceScope namespaceScope) {
     //Debug.WriteLineIf( XmlTrace.traceXPathNodePointerFunctions.Enabled, "XPathNodePointer:MoveToNextNamespace(namespaceScope)");
     RealFoliate();
     Debug.Assert( _parentOfNS != null );
     XmlNode node = this._node;
     //first check within the same boundelement
     if ( this._column != null ) {
         Debug.Assert( this._column.Namespace == s_strReservedXmlns );
         if ( namespaceScope == XPathNamespaceScope.Local && _parentOfNS != this._node ) //already outside scope
             return false;
         XmlBoundElement be = this._node as XmlBoundElement;
         Debug.Assert( be != null );
         DataRow curRow = be.Row;
         Debug.Assert( curRow != null );
         DataColumn curCol = PreviousColumn( curRow, this._column, true );
         while ( curCol != null ) {
             if ( curCol.Namespace == s_strReservedXmlns ) {
                 MoveTo( be, curCol, false );
                 return true;
             }
             curCol = PreviousColumn( curRow, curCol, true );
         }                
         //didn't find it in this loop
         if ( namespaceScope == XPathNamespaceScope.Local )
             return false;
         //try its ancesstor
         do {
             node = node.ParentNode;
         } while ( node != null && node.NodeType != XmlNodeType.Element );
     } 
     else  if ( this._node.NodeType == XmlNodeType.Attribute ) {
         XmlAttribute attr = (XmlAttribute)(this._node);
         Debug.Assert( attr != null );
         node = attr.OwnerElement;
         if ( node == null )
             return false;
         if ( namespaceScope == XPathNamespaceScope.Local && _parentOfNS != node ) //already outside scope
             return false;
         if ( MoveToNextNamespace( (XmlBoundElement)node, null, (XmlAttribute)attr ) )
             return true;
         //didn't find it
         if ( namespaceScope == XPathNamespaceScope.Local )
             return false;
         do {
             node = node.ParentNode;
         } while ( node != null && node.NodeType != XmlNodeType.Element );
     }
     // till now, node should be the next accesstor (bound) element of the element parent of current namespace node (attribute or data column)
     while ( node != null ) {
         //try the namespace attributes from the same element
         XmlBoundElement be = node as XmlBoundElement;
         if ( MoveToNextNamespace( be, null, null ) )
             return true;
         //no more namespace attribute under the same element
         do {
             node = node.ParentNode;
         } while ( node != null && node.NodeType == XmlNodeType.Element );
     }
     //didn't find the next namespace, thus return
     if ( namespaceScope == XPathNamespaceScope.All ) {
         MoveTo( this._doc.attrXml, null, false );
         return true;
     }
     return false;
 }
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:66,代码来源:XPathNodePointer.cs


示例14: MoveToNextNamespace

		public override bool MoveToNextNamespace (XPathNamespaceScope scope)
		{
			if (attr == null)
				return false;
			for (XAttribute a = attr.NextAttribute; a != null; a = a.NextAttribute)
				if (a.IsNamespaceDeclaration) {
					attr = a;
					return true;
				}

			if (scope == XPathNamespaceScope.Local)
				return false;

			for (XElement el = ((XElement) attr.Parent).Parent; el != null; el = el.Parent) {
				foreach (XAttribute a in el.Attributes ())
					if (a.IsNamespaceDeclaration) {
						attr = a;
						return true;
					}
			}
			if (scope != XPathNamespaceScope.All)
				return false;
			attr = attr_ns_xml;
			return true;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:25,代码来源:XNodeNavigator.cs


示例15: MoveToFirstNamespace

 //Moves to the first namespace node depending upon the namespace scope.
 public override bool MoveToFirstNamespace( XPathNamespaceScope nsScope ) { 
     if( nsScope == XPathNamespaceScope.Local ) {
         XmlElement _parentOfNS = _curNode as XmlElement;
         if( _parentOfNS == null )
             return false;
         if( MoveToFirstLocalNamespace( _curNode ) )
             return true;
         else {
             _parentOfNS = null;
             return false;
         }                    
     }
     else if( nsScope == XPathNamespaceScope.ExcludeXml )
         return MoveToFirstNonXmlNamespace();                
     else if( nsScope == XPathNamespaceScope.All ) {                
         _parentOfNS = _curNode as XmlElement;
         XmlElement cache = _parentOfNS;
         if( _parentOfNS == null )
             return false;
         if( MoveToFirstNonXmlNamespace() )
             return true;
         _parentOfNS = cache;
         _curNode = attrXmlNS;
         return true;
     }
     else return false;
 }
开发者ID:ArildF,项目名称:masters,代码行数:28,代码来源:documentxpathnavigator.cs


示例16: MoveToNextNamespace

		public override bool MoveToNextNamespace (XPathNamespaceScope scope)
		{
			return navigator.MoveToNextNamespace (scope);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:4,代码来源:XPathEditableDocument.cs


示例17: MoveToNextNamespace

 //Moves to the next namespace node depending upon the namespace scope.
 public override bool MoveToNextNamespace( XPathNamespaceScope nsScope ) {
     //Navigator should be on a Namespace node when this is called.
     if ( ( _curNode.NodeType != XmlNodeType.Attribute ) || ( ! ( Ref.Equal(_curNode.NamespaceURI, XmlDocument.strReservedXmlns) ) ) )
         return false;
     if( nsScope == XPathNamespaceScope.Local ) {
         XmlAttribute attr = _curNode as XmlAttribute;
         if( _curNode == null )
             return false;
         _curNode = attr.OwnerElement;
         if( _curNode == null )
             return false;
         //Navigator is no more in local scope if the following 
         //condition is satisfied.
         if( _curNode != _parentOfNS )
             return false;
         return MoveToNextLocalNamespace( _curNode, _attrInd );
     }
     else if( nsScope == XPathNamespaceScope.ExcludeXml )
         return MoveToNextNonXmlNamespace();                
     else if( nsScope == XPathNamespaceScope.All ) {
         XmlNode temp = ((XmlAttribute)_curNode).OwnerElement;
         if( temp == null )
             return false;
         if( MoveToNextNonXmlNamespace() )
             return true;
         _curNode = attrXmlNS;
         return true;                 
     }
     else
         return false;
 }
开发者ID:ArildF,项目名称:masters,代码行数:32,代码来源:documentxpathnavigator.cs


示例18: moveToSpecifiedNamespace

		private bool moveToSpecifiedNamespace (int cur,
			XPathNamespaceScope namespaceScope)
		{
			if (cur == 0)
				return false;

			if (namespaceScope == XPathNamespaceScope.Local &&
					namespaces [cur].DeclaredElement != currentNode)
				return false;

			if (namespaceScope != XPathNamespaceScope.All
				&& namespaces [cur].Namespace == XmlNamespaces.XML)
				return false;

			if (cur != 0) {
				moveToNamespace (cur);
				return true;
			}
			else
				return false;
		}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:21,代码来源:DTMXPathNavigator.cs


示例19: MoveToFirstNamespace

        /// <summary>
        /// Position the navigator on the namespace within the specified scope.  If no matching namespace
        /// can be found, return false.
        /// </summary>
        public override bool MoveToFirstNamespace(XPathNamespaceScope namespaceScope)
        {
            XPathNode[] page;
            int idx;

            if (namespaceScope == XPathNamespaceScope.Local)
            {
                // Get local namespaces only
                idx = XPathNodeHelper.GetLocalNamespaces(_pageCurrent, _idxCurrent, out page);
            }
            else
            {
                // Get all in-scope namespaces
                idx = XPathNodeHelper.GetInScopeNamespaces(_pageCurrent, _idxCurrent, out page);
            }

            while (idx != 0)
            {
                // Don't include the xmlns:xml namespace node if scope is ExcludeXml
                if (namespaceScope != XPathNamespaceScope.ExcludeXml || !page[idx].IsXmlNamespaceNode)
                {
                    _pageParent = _pageCurrent;
                    _idxParent = _idxCurrent;
                    _pageCurrent = page;
                    _idxCurrent = idx;
                    return true;
                }

                // Skip past xmlns:xml
                idx = page[idx].GetSibling(out page);
            }

            return false;
        }
开发者ID:svcgany1,项目名称:corefx,代码行数:38,代码来源:XPathDocumentNavigator.cs


示例20: MoveToNextNamespace

		public override bool MoveToNextNamespace (
			XPathNamespaceScope namespaceScope)
		{
			if (currentIsAttr || currentIsNode)
				return false;

			int cur = namespaces [currentNs].NextNamespace;
			return moveToSpecifiedNamespace (cur, namespaceScope);
		}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:9,代码来源:DTMXPathNavigator.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# XPathNode类代码示例发布时间:2022-05-24
下一篇:
C# XPCollection类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap