Esempio n. 1
0
        /// <summary>
        /// Create an iterator that ranges over all element children of "parent" having the specified QName.
        /// </summary>
        public XPathDocumentElementChildIterator(XPathDocumentNavigator parent, string name, string namespaceURI) : base(parent)
        {
            if (namespaceURI == null) throw new ArgumentNullException("namespaceURI");

            _localName = parent.NameTable.Get(name);
            _namespaceUri = namespaceURI;
        }
        public override object GetValue(object o)
        {
            if (null == o)
            {
                throw new ArgumentNullException("XPathNodeViewPropertyDescriptor.GetValue");
            }
            XPathNodeView xiv = (XPathNodeView)o;

            if (xiv.Collection.RowShape != this.rowShape)
            {
                throw new ArgumentException("XPathNodeViewPropertyDescriptor.GetValue");
            }
            object    val = xiv.Column(this.colIndex);
            XPathNode nd  = val as XPathNode;

            if (null != nd)
            {
                XPathDocumentNavigator nav  = new XPathDocumentNavigator(nd, null);
                XmlSchemaType          xst  = nd.SchemaType;
                XmlSchemaComplexType   xsct = xst as XmlSchemaComplexType;
                if (null == xst || ((null != xsct) && xsct.IsMixed))
                {
                    return(nav.InnerXml);
                }
                else
                {
                    return(nav.TypedValue);
                }
            }
            return(val);
        }
Esempio n. 3
0
        int IEqualityComparer.GetHashCode(object obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }
            XPathDocumentNavigator navigator2 = obj as XPathDocumentNavigator;

            if (navigator2 != null)
            {
                return(navigator2.GetPositionHashCode());
            }
            XPathNavigator navigator = obj as XPathNavigator;

            if (navigator != null)
            {
                object underlyingObject = navigator.UnderlyingObject;
                if (underlyingObject != null)
                {
                    return(underlyingObject.GetHashCode());
                }
                int num = ((int)navigator.NodeType) ^ navigator.LocalName.GetHashCode();
                num ^= navigator.Prefix.GetHashCode();
                return(num ^ navigator.NamespaceURI.GetHashCode());
            }
            return(obj.GetHashCode());
        }
 public XPathDocumentElementDescendantIterator(XPathDocumentElementDescendantIterator iter) : base(iter)
 {
     this.end = iter.end;
     this.localName = iter.localName;
     this.namespaceUri = iter.namespaceUri;
     this.matchSelf = iter.matchSelf;
 }
 public XPathDocumentKindDescendantIterator(XPathDocumentNavigator root, XPathNodeType typ, bool matchSelf) : base(root)
 {
     this.typ = typ;
     this.matchSelf = matchSelf;
     if (root.NodeType != XPathNodeType.Root)
     {
         this.end = new XPathDocumentNavigator(root);
         this.end.MoveToNonDescendant();
     }
 }
 public XPathDocumentElementDescendantIterator(XPathDocumentNavigator root, string name, string namespaceURI, bool matchSelf) : base(root)
 {
     if (namespaceURI == null)
     {
         throw new ArgumentNullException("namespaceURI");
     }
     this.localName = root.NameTable.Get(name);
     this.namespaceUri = namespaceURI;
     this.matchSelf = matchSelf;
     if (root.NodeType != XPathNodeType.Root)
     {
         this.end = new XPathDocumentNavigator(root);
         this.end.MoveToNonDescendant();
     }
 }
 private int GetFollowingEnd(XPathDocumentNavigator end, bool useParentOfVirtual, out XPathNode[] pageEnd)
 {
     if ((end != null) && (this.pageCurrent[this.idxCurrent].Document == end.pageCurrent[end.idxCurrent].Document))
     {
         if (end.idxParent == 0)
         {
             pageEnd = end.pageCurrent;
             return end.idxCurrent;
         }
         pageEnd = end.pageParent;
         if (!useParentOfVirtual)
         {
             return (end.idxParent + 1);
         }
         return end.idxParent;
     }
     pageEnd = null;
     return 0;
 }
Esempio n. 8
0
 /// <summary>
 /// Create a new iterator that is a copy of "iter".
 /// </summary>
 protected XPathDocumentBaseIterator(XPathDocumentBaseIterator iter)
 {
     this.ctxt = new XPathDocumentNavigator(iter.ctxt);
     this.pos = iter.pos;
 }
Esempio n. 9
0
 /// <summary>
 /// Create a new iterator that is a copy of "iter".
 /// </summary>
 public XPathDocumentKindDescendantIterator(XPathDocumentKindDescendantIterator iter) : base(iter)
 {
     _end = iter._end;
     _typ = iter._typ;
     _matchSelf = iter._matchSelf;
 }
Esempio n. 10
0
        /// <summary>
        /// Create an iterator that ranges over all content descendants of "root" having the specified XPathNodeType.
        /// </summary>
        public XPathDocumentKindDescendantIterator(XPathDocumentNavigator root, XPathNodeType typ, bool matchSelf) : base(root)
        {
            _typ = typ;
            _matchSelf = matchSelf;

            // Find the next non-descendant node that follows "root" in document order
            if (root.NodeType != XPathNodeType.Root)
            {
                _end = new XPathDocumentNavigator(root);
                _end.MoveToNonDescendant();
            }
        }
Esempio n. 11
0
 /// <summary>
 /// Create a new iterator that is a copy of "iter".
 /// </summary>
 public XPathDocumentElementDescendantIterator(XPathDocumentElementDescendantIterator iter) : base(iter)
 {
     _end = iter._end;
     _localName = iter._localName;
     _namespaceUri = iter._namespaceUri;
     _matchSelf = iter._matchSelf;
 }
Esempio n. 12
0
        /// <summary>
        /// Create an iterator that ranges over all element descendants of "root" having the specified QName.
        /// </summary>
        public XPathDocumentElementDescendantIterator(XPathDocumentNavigator root, string name, string namespaceURI, bool matchSelf) : base(root)
        {
            if (namespaceURI == null) throw new ArgumentNullException("namespaceURI");

            _localName = root.NameTable.Get(name);
            _namespaceUri = namespaceURI;
            _matchSelf = matchSelf;

            // Find the next non-descendant node that follows "root" in document order
            if (root.NodeType != XPathNodeType.Root)
            {
                _end = new XPathDocumentNavigator(root);
                _end.MoveToNonDescendant();
            }
        }
Esempio n. 13
0
 /// <summary>
 /// Create an iterator that ranges over all content children of "parent" having the specified XPathNodeType.
 /// </summary>
 public XPathDocumentKindChildIterator(XPathDocumentNavigator parent, XPathNodeType typ) : base(parent)
 {
     _typ = typ;
 }
 /// <summary>
 /// Create a new iterator that is a copy of "iter".
 /// </summary>
 public XPathDocumentKindDescendantIterator(XPathDocumentKindDescendantIterator iter) : base(iter) {
     this.end = iter.end;
     this.typ = iter.typ;
     this.matchSelf = iter.matchSelf;
 }
Esempio n. 15
0
        /// <summary>
        /// "end" is positioned on a node which terminates a following scan.  Return the page and index of "end" if it
        /// is positioned to a non-virtual node.  If "end" is positioned to a virtual node:
        ///    1. If useParentOfVirtual is true, then return the page and index of the virtual node's parent
        ///    2. If useParentOfVirtual is false, then return the page and index of the virtual node's parent + 1.
        /// </summary>
        private int GetFollowingEnd(XPathDocumentNavigator end, bool useParentOfVirtual, out XPathNode[] pageEnd)
        {
            // If ending navigator is positioned to a node in another document, then return null
            if (end != null && _pageCurrent[_idxCurrent].Document == end._pageCurrent[end._idxCurrent].Document)
            {
                // If the ending navigator is not positioned on a virtual node, then return its current node
                if (end._idxParent == 0)
                {
                    pageEnd = end._pageCurrent;
                    return end._idxCurrent;
                }

                // If the ending navigator is positioned on an attribute, namespace, or virtual text node, then use the
                // next physical node instead, as the results will be the same.
                pageEnd = end._pageParent;
                return (useParentOfVirtual) ? end._idxParent : end._idxParent + 1;
            }

            // No following, so set pageEnd to null and return an index of 0
            pageEnd = null;
            return 0;
        }
Esempio n. 16
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 public XPathDocumentNavigator(XPathDocumentNavigator nav) : this(nav._pageCurrent, nav._idxCurrent, nav._pageParent, nav._idxParent)
 {
     _atomizedLocalName = nav._atomizedLocalName;
 }
Esempio n. 17
0
 /// <summary>
 /// Create a new iterator that is initially positioned on the "ctxt" node.
 /// </summary>
 protected XPathDocumentBaseIterator(XPathDocumentNavigator ctxt)
 {
     this.ctxt = new XPathDocumentNavigator(ctxt);
 }