Ejemplo n.º 1
0
        // lengnth of the XML document (in byte))
        /**
         * Initialize the VTD navigation object.
         *
         * @param RootIndex
         *            int
         * @param maxDepth
         *            int
         * @param encoding
         *            int
         * @param NS
         *            boolean
         * @param x
         *            byte[]
         * @param vtd
         *            com.ximpleware.ILongBuffer
         * @param l1
         *            com.ximpleware.ILongBuffer
         * @param l2
         *            com.ximpleware.ILongBuffer
         * @param l3
         *            com.ximpleware.IIntBuffer
         * @param so
         *            int starting offset of the document(in byte)
         * @param length
         *            int length of the document (in byte)
         */
        protected internal VTDNav_L5(
            int RootIndex,
            int enc,
            bool NS,
            int depth,
            IByteBuffer x,
            FastLongBuffer vtd,
            FastLongBuffer l1,
            FastLongBuffer l2,
            FastLongBuffer l3,
            FastLongBuffer l4,
            FastIntBuffer l5,
            int so, // start offset of the starting offset(in byte)
            int length)
        {
            //super();
            // initialize all buffers
            if (l1 == null
                || l2 == null
                || l3 == null
                || vtd == null
                || x == null
                || depth < 0
                || RootIndex < 0 //|| encoding <= FORMAT_UTF8
                //|| encoding >= FORMAT_ISO_8859_1
                || so < 0
                || length < 0)
            {
                throw new System.ArgumentException();
            }

            count = 0;
            l1Buffer = l1;
            l2Buffer = l2;
            l3Buffer = l3;
            l4Buffer = l4;
            l5Buffer = l5;
            vtdBuffer = vtd;
            XMLDoc = x;

            encoding = enc;
            //System.out.println("encoding " + encoding);
            rootIndex = RootIndex;
            nestingLevel = depth + 1;
            ns = NS; // namespace aware or not
            if (ns == false)
                MASK_TOKEN_OFFSET = 0x000000007fffffffL; // this allows xml size to
            // be 2GB
            else // if there is no namespace
                MASK_TOKEN_OFFSET = 0x000000003fffffffL;

            atTerminal = false; //this variable will only change value during XPath
            // eval

            // initialize the context object
            this.context = new int[nestingLevel];
            //depth value is the first entry in the context because root is
            // singular.
            context[0] = 0;
            //set the value to zero
            for (int i = 1; i < nestingLevel; i++)
            {
                context[i] = -1;
            }
            //currentOffset = 0;
            //contextStack = new ContextBuffer(1024, nestingLevel + 7);
            contextStack = new ContextBuffer(10, nestingLevel + 15);
            contextStack2 = new ContextBuffer(10, nestingLevel + 15);
            stackTemp = new int[nestingLevel + 15];

            // initial state of LC variables
            l1index = l2index = l3index = l4index = l5index = -1;
            l2lower = l3lower = l4lower = l5lower = -1;
            l2upper = l3upper = l4upper = l5upper = -1;
            docOffset = so;
            docLen = length;
            //System.out.println("offset " + offset + " length " + length);
            //printL2Buffer();
            vtdSize = vtd.size_Renamed_Field;
            //writeOffsetAdjustment = false;
            //recentNS = -1;
            name = null;
            nameIndex = -1;
            localName = null;
            localNameIndex = -1;
            fib = new FastIntBuffer(5); // page size is 32 ints
            shallowDepth = false;
            maxLCDepthPlusOne = 6;
        }
Ejemplo n.º 2
0
        /// <summary> Initialize the VTD navigation object.</summary>
        /// <param name="RootIndex">int
        /// </param>
        /// <param name="maxDepth">int
        /// </param>
        /// <param name="encoding">int
        /// </param>
        /// <param name="NS"> boolean
        /// </param>
        /// <param name="x">byte[]
        /// </param>
        /// <param name="vtd">com.ximpleware.ILongBuffer
        /// </param>
        /// <param name="l1">com.ximpleware.ILongBuffer
        /// </param>
        /// <param name="l2">com.ximpleware.ILongBuffer
        /// </param>
        /// <param name="l3">com.ximpleware.IIntBuffer
        /// </param>
        /// <param name="so">int  starting offset of the document(in byte)
        /// </param>
        /// <param name="length">int length of the document (in byte)
        /// </param>
        protected internal VTDNav(int RootIndex, int enc, bool NS, int depth, IByteBuffer x, FastLongBuffer vtd, FastLongBuffer l1, FastLongBuffer l2, FastIntBuffer l3, int so, int length)
        {
            // initialize all buffers
            if (l1 == null || l2 == null || l3 == null || vtd == null || x == null || depth < 0 || RootIndex < 0 || so < 0 || length < 0)
            {
                throw new System.ArgumentException();
            }
            count = 0;
            l1Buffer = l1;
            l2Buffer = l2;
            l3Buffer = l3;
            vtdBuffer = vtd;
            XMLDoc = x;

            encoding = enc;
            //System.out.println("encoding " + encoding);
            rootIndex = RootIndex;
            nestingLevel = depth + 1;
            ns = NS; // namespace aware or not
            if (ns == false)
                MASK_TOKEN_OFFSET = 0x000000007fffffff;
            // this allows xml size to be 2GB 
            // if there is no namespace
            else
                MASK_TOKEN_OFFSET = 0x000000003fffffff;


            atTerminal = false; //this variable will only change value during XPath eval

            // initialize the context object
            context = new int[nestingLevel];
            //depth value is the first entry in the context because root is singular.
            context[0] = 0;
            //set the value to zero
            for (int i = 1; i < nestingLevel; i++)
            {
                context[i] = -1;
            }
            // currentOffset = 0;
            //contextStack = new ContextBuffer(1024, nestingLevel + 7);
            contextStack = new ContextBuffer(10, nestingLevel + 9);
            contextStack2 = new ContextBuffer(10, nestingLevel + 9);
            stackTemp = new int[nestingLevel + 9];

            // initial state of LC variables
            l1index = l2index = l3index = -1;
            l2lower = l3lower = -1;
            l2upper = l3upper = -1;
            docOffset = so;
            docLen = length;
            //System.out.println("offset " + offset + "  length " + length);
            //printL2Buffer();
            vtdSize = vtd.size_Renamed_Field;
            name = null;
            nameIndex = -1;
            localName = null;
            localNameIndex = -1;
            fib = new FastIntBuffer(5);
            shallowDepth = true;
            //recentNS = -1;
        }