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


C# XPathNamespaceScope类代码示例

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


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


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