예제 #1
0
        BaseIterator ToBaseIterator(XPathNodeIterator iter, NSResolver ctx)
        {
            BaseIterator i = iter as BaseIterator;

            if (i == null)
            {
                i = new WrapperIterator(iter, ctx);
            }
            return(i);
        }
예제 #2
0
        public override object Evaluate(BaseIterator iter)
        {
            object            obj = this._expr.Evaluate(iter);
            XPathNodeIterator xpathNodeIterator = obj as XPathNodeIterator;
            BaseIterator      baseIterator      = xpathNodeIterator as BaseIterator;

            if (baseIterator == null && xpathNodeIterator != null)
            {
                baseIterator = new WrapperIterator(xpathNodeIterator, iter.NamespaceManager);
            }
            if (baseIterator != null)
            {
                return(new ParensIterator(baseIterator));
            }
            return(obj);
        }
예제 #3
0
        public virtual BaseIterator EvaluateNodeSet(BaseIterator iter)
        {
            XPathResultType returnType = this.GetReturnType(iter);

            switch (returnType)
            {
            case XPathResultType.NodeSet:
            case XPathResultType.Navigator:
            case XPathResultType.Any:
            {
                object            obj = this.Evaluate(iter);
                XPathNodeIterator xpathNodeIterator = obj as XPathNodeIterator;
                BaseIterator      baseIterator      = null;
                if (xpathNodeIterator != null)
                {
                    baseIterator = (xpathNodeIterator as BaseIterator);
                    if (baseIterator == null)
                    {
                        baseIterator = new WrapperIterator(xpathNodeIterator, iter.NamespaceManager);
                    }
                    return(baseIterator);
                }
                XPathNavigator xpathNavigator = obj as XPathNavigator;
                if (xpathNavigator != null)
                {
                    XPathNodeIterator xpathNodeIterator2 = xpathNavigator.SelectChildren(XPathNodeType.All);
                    baseIterator = (xpathNodeIterator2 as BaseIterator);
                    if (baseIterator == null && xpathNodeIterator2 != null)
                    {
                        baseIterator = new WrapperIterator(xpathNodeIterator2, iter.NamespaceManager);
                    }
                }
                if (baseIterator != null)
                {
                    return(baseIterator);
                }
                if (obj == null)
                {
                    return(new NullIterator(iter));
                }
                returnType = Expression.GetReturnType(obj);
                break;
            }
            }
            throw new XPathException(string.Format("expected nodeset but was {1}: {0}", this.ToString(), returnType));
        }
		BaseIterator ToBaseIterator (XPathNodeIterator iter, NSResolver ctx)
		{
			BaseIterator i = iter as BaseIterator;
			if (i == null)
				i = new WrapperIterator (iter, ctx);
			return i;
		}
예제 #5
0
 private WrapperIterator(WrapperIterator other)
     : base(other)
 {
     iter = other.iter.Clone();
 }
예제 #6
0
파일: Iterator.cs 프로젝트: cyplo/mono
		private WrapperIterator (WrapperIterator other)
			: base (other)
		{
			iter = other.iter.Clone ();
		}
예제 #7
0
파일: Expression.cs 프로젝트: nobled/mono
		public virtual BaseIterator EvaluateNodeSet (BaseIterator iter)
		{
			XPathResultType type = GetReturnType (iter);
			switch (type) {
			case XPathResultType.NodeSet:
			case XPathResultType.Any:
			case XPathResultType.Navigator: // FIXME: It may pass not-allowed use of RTF
				object o = Evaluate (iter);
				XPathNodeIterator xi = o as XPathNodeIterator;
				BaseIterator iterResult = null;
				if (xi != null) {
					iterResult = xi as BaseIterator;
					if (iterResult == null)
						iterResult = new WrapperIterator (xi, iter.NamespaceManager);
					return iterResult;
				}
				XPathNavigator nav = o as XPathNavigator;
				if (nav != null) {
					XPathNodeIterator xiter = nav.SelectChildren (XPathNodeType.All);
					iterResult = xiter as BaseIterator;
					if (iterResult == null && xiter != null)
						iterResult = new WrapperIterator (xiter, iter.NamespaceManager);
				}
				if (iterResult != null)
					return iterResult;
				if (o == null)
					return new NullIterator (iter);
				type = GetReturnType (o);
				break;
			}
			throw new XPathException (String.Format ("expected nodeset but was {1}: {0}", ToString (), type));
		}
예제 #8
0
파일: Expression.cs 프로젝트: nobled/mono
		public override object Evaluate (BaseIterator iter)
		{
			object o = (_expr.Evaluate (iter));
			XPathNodeIterator xi = o as XPathNodeIterator;
			BaseIterator predBase = xi as BaseIterator;
			if (predBase == null && xi != null)
				predBase = new WrapperIterator (xi, iter.NamespaceManager);
			if (predBase != null)
				return new ParensIterator (predBase);
			else
				return o;
		}