Esempio n. 1
0
        public void MoveTo(IXmlNode position)
        {
            var source = position.AsRealizable <XPathNavigator>();

            if (source == null || !source.IsReal)
            {
                throw Error.CursorCannotMoveToGivenNode();
            }

            var positionNode = source.Value;

            Reset();

            if (iterator != null)
            {
                while (iterator.MoveNext())
                {
                    if (iterator.Current.IsSamePosition(positionNode))
                    {
                        SetAtNext();
                        return;
                    }
                }
            }

            throw Error.CursorCannotMoveToGivenNode();
        }
Esempio n. 2
0
        public void MoveTo(IXmlNode position)
        {
            var source = position.AsRealizable <XmlNode>();

            if (source == null || !source.IsReal)
            {
                throw Error.CursorCannotMoveToGivenNode();
            }

            IXmlKnownType knownType;

            if (!knownTypes.TryGet(position, out knownType))
            {
                throw Error.CursorCannotMoveToGivenNode();
            }

            node = source.Value;
            type = knownType.ClrType;

            if (IsElement)
            {
                SetMovedToElement();
            }
            else
            {
                SetMovedToAttribute();
            }
        }
Esempio n. 3
0
        public override object GetValue(IXmlNode node, IDictionaryAdapter parent, IXmlAccessor accessor)
        {
            var source = node.AsRealizable <XmlNode>();

            return((source != null && source.Exists)
                                ? source.Value
                                : null);
        }
Esempio n. 4
0
		public override object GetValue(IXmlNode node, IDictionaryAdapter parent, IXmlAccessor accessor)
		{
			var source = node.AsRealizable<XmlNode>();

			return (source != null && source.IsReal)
				? source.Value
				: null;
		}
Esempio n. 5
0
        public bool UnderlyingPositionEquals(IXmlNode node)
        {
            var sysXmlNode = node.AsRealizable <XmlNode>();

            if (sysXmlNode != null)
            {
                return(sysXmlNode.IsReal && sysXmlNode.Value == this.node);
            }

            var xPathNode = node.AsRealizable <XPathNavigator>();

            if (xPathNode != null)
            {
                return(xPathNode.IsReal && xPathNode.Value.UnderlyingObject == this.node);
            }

            return(false);
        }
Esempio n. 6
0
        public bool UnderlyingPositionEquals(IXmlNode node)
        {
#if !SILVERLIGHT
            var sysXmlNode = node.AsRealizable <XmlNode>();
            if (sysXmlNode != null)
            {
                return(sysXmlNode.IsReal &&
                       sysXmlNode.Value == this.node.UnderlyingObject);
            }
#endif
#if SILVERLIGHT
            // TODO: XNode-based
#endif
            var xPathNode = node.AsRealizable <XPathNavigator>();
            if (xPathNode != null)
            {
                return(xPathNode.IsReal &&
                       xPathNode.Value.IsSamePosition(this.node));
            }

            return(false);
        }
Esempio n. 7
0
        public void MoveTo(IXmlNode position)
        {
            var source = position.AsRealizable <XPathNavigator>();

            if (source == null || !source.Exists)
            {
                throw Error.CursorCannotMoveToGivenNode();
            }

            var positionNode = source.Value;

            Reset();
            while (MoveNext())
            {
                if (HasCurrent && node.IsSamePosition(positionNode))
                {
                    return;
                }
            }

            throw Error.CursorCannotMoveToGivenNode();
        }
Esempio n. 8
0
		public void MoveTo(IXmlNode position)
		{
			var source = position.AsRealizable<XmlNode>();
			if (source == null || !source.IsReal)
				throw Error.CursorCannotMoveToGivenNode();

			IXmlKnownType knownType;
			if (!knownTypes.TryGet(position, out knownType))
				throw Error.CursorCannotMoveToGivenNode();

			node = source.Value;
			type = knownType.ClrType;

			if (IsElement)
				SetMovedToElement();
			else
				SetMovedToAttribute();
		}
Esempio n. 9
0
		public void MoveTo(IXmlNode position)
		{
			var source = position.AsRealizable<XPathNavigator>();
			if (source == null || !source.IsReal)
				throw Error.CursorCannotMoveToGivenNode();

			var positionNode = source.Value;

			Reset();
			while (MoveNext())
				if (HasCurrent && node.IsSamePosition(positionNode))
					return;

			throw Error.CursorCannotMoveToGivenNode();
		}
Esempio n. 10
0
 public IRealizable <T> AsRealizable <T>()
 {
     return(node.AsRealizable <T>());
 }
		public void MoveTo(IXmlNode position)
		{
			var source = position.AsRealizable<XPathNavigator>();
			if (source == null || !source.IsReal)
				throw Error.CursorCannotMoveToGivenNode();

			var positionNode = source.Value;

			Reset();

			if (iterator != null)
				while (iterator.MoveNext())
					if (iterator.Current.IsSamePosition(positionNode))
						{ SetAtNext(); return; }

			throw Error.CursorCannotMoveToGivenNode();
		}