Пример #1
0
        private static bool isDuplicate(Node node, ResultBuffer rs)
        {
            IEnumerator it = rs.iterator();

            while (it.MoveNext())
            {
                if (it.Current.Equals(node))
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected static boolean hasValue(org.eclipse.wst.xml.xpath2.api.ResultBuffer rs, org.eclipse.wst.xml.xpath2.processor.internal.types.AnyAtomicType item, org.eclipse.wst.xml.xpath2.api.DynamicContext context, String collationURI) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        protected internal static bool hasValue(ResultBuffer rs, AnyAtomicType item, DynamicContext context, string collationURI)
        {
            XSString itemStr = new XSString(item.StringValue);

            for (IEnumerator i = rs.iterator(); i.MoveNext();)
            {
                AnyType at = (AnyType)i.Current;

                if (!(at is CmpEq))
                {
                    continue;
                }

                if (isBoolean(item, at))
                {
                    XSBoolean boolat = (XSBoolean)at;
                    if (boolat.eq(item, context))
                    {
                        return(true);
                    }
                }

                if (isNumeric(item, at))
                {
                    NumericType numericat = (NumericType)at;
                    if (numericat.eq(item, context))
                    {
                        return(true);
                    }
                }

                if (isDuration(item, at))
                {
                    XSDuration durat = (XSDuration)at;
                    if (durat.eq(item, context))
                    {
                        return(true);
                    }
                }

                if (needsStringComparison(item, at))
                {
                    XSString xstr1 = new XSString(at.StringValue);
                    if (FnCompare.compare_string(collationURI, xstr1, itemStr, context).Equals(System.Numerics.BigInteger.Zero))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Пример #3
0
        /// <summary>
        /// Return the result of FollowingAxis expression
        /// </summary>
        /// <param name="node">
        ///            is the type of node. </param>
        public override void iterate(NodeType node, ResultBuffer result, Node limitNode)
        {
            // XXX should be root... not parent!!! read the spec.... BUG BUG
            // BUG LAME LAME....

            if (limitNode != null && limitNode.isSameNode(node.node_value()))
            {
                // no further, we have reached the limit node
                return;
            }

            // get the parent
            NodeType     parent       = null;
            ResultBuffer parentBuffer = new ResultBuffer();

            (new ParentAxis()).iterate(node, parentBuffer, limitNode);
            if (parentBuffer.size() == 1)
            {
                parent = (NodeType)parentBuffer.item(0);
            }

            // get the following siblings of this node, and add them
            FollowingSiblingAxis fsa           = new FollowingSiblingAxis();
            ResultBuffer         siblingBuffer = new ResultBuffer();

            fsa.iterate(node, siblingBuffer, limitNode);

            // for each sibling, get all its descendants
            DescendantAxis da = new DescendantAxis();

            for (IEnumerator i = siblingBuffer.iterator(); i.MoveNext();)
            {
                result.add((NodeType)i);
                da.iterate((NodeType)i.Current, result, null);
            }

            // if we got a parent, we gotta repeat the story for the parent
            // and add the results
            if (parent != null)
            {
                iterate(parent, result, limitNode);
            }
        }