Package org.apache.xerces.utils

Examples of org.apache.xerces.utils.QName


        int curState = 0;
        int nextState = 0;
        for (int childIndex = 0; childIndex < length; childIndex++)
        {
            // Get the current element index out
            final QName curElem = children[offset + childIndex];

            // Look up this child in our element map
            int elemIndex = 0;
            for (; elemIndex < fElemMapSize; elemIndex++)
            {
View Full Code Here


        //
        int curState = 0;
        for (int childIndex = 0; childIndex < info.insertAt; childIndex++)
        {
            // Get the current element index out
            final QName curElem = info.curChildren[childIndex];

            // Look up this child in our element map
            int elemIndex = 0;
            for (; elemIndex < fElemMapSize; elemIndex++)
            {
                if (fElemMap[elemIndex].uri == curElem.uri &&
                    fElemMap[elemIndex].localpart == curElem.localpart)
                    break;
            }

            // If we didn't find it, then not valid so return failure index
            if (elemIndex == fElemMapSize)
                return childIndex;

            //
            //  Look up the next state for this input symbol when in the
            //  current state.
            //
            curState = fTransTable[curState][elemIndex];

            // If its not a legal transition, then invalid
            if (curState == -1)
                return childIndex;
        }

        //
        //  If we got here, then curState is set to the state that would be
        //  the transition before the insertion point. We let this sit until
        //  below, where it will be needed.
        //
        final int insertState = curState;

        //
        //  Set any stuff we can know right off the bat for all cases.
        //  We can set the valid EOC flag at this point
        //  since its just based on the state we ended in at the insert point.
        //  The 'canHoldPCData" will be true if it's a mixed content model.
        //
        info.canHoldPCData = fMixed;
        info.isValidEOC = fFinalStateFlags[insertState];

        //
        //  Set the results count member and then see if we need to reallocate
        //  the outgoing arrays.
        //
        info.resultsCount = fElemMapSize;

        if ((info.results == null) || (info.results.length < info.resultsCount))
            info.results = new boolean[info.resultsCount];

        if ((info.possibleChildren == null)
        ||  (info.possibleChildren.length < info.resultsCount))
        {
            info.possibleChildren = new QName[info.resultsCount];
            for (int i = 0; i < info.possibleChildren.length; i++) {
                info.possibleChildren[i] = new QName();
            }
        }

        //
        //  Fill in the possible children array, from our array. For each one
View Full Code Here

        fElemMap = new QName[fLeafCount];
        fElemMapType = new int[fLeafCount];
        fElemMapSize = 0;
        for (int outIndex = 0; outIndex < fLeafCount; outIndex++)
        {
            fElemMap[outIndex] = new QName();

            if ( (fLeafListType[outIndex] & 0x0f) != 0 ) {
                if (fLeafNameTypeVector == null) {
                    fLeafNameTypeVector = new ContentLeafNameTypeVector();
                }
            }

            // Get the current leaf's element index
            final QName element = fLeafList[outIndex].getElement();

            // See if the current leaf node's element index is in the list
            int inIndex = 0;
            for (; inIndex < fElemMapSize; inIndex++)
            {
                if (fDTD) {
                    if (fElemMap[inIndex].rawname == element.rawname) {
                        break;
                    }
                }
                else {
                    if (fElemMapType[inIndex] == fLeafListType[outIndex] &&
                        fElemMap[inIndex].uri == element.uri &&
                            fElemMap[inIndex].localpart == element.localpart)
                        break;
                }
            }

            // If it was not in the list, then add it, if not the EOC node
            if (inIndex == fElemMapSize) {
                //if (fDTD) {
                //    fElemMap[fElemMapSize].setValues(-1, element.rawname, element.rawname, -1);
                //}
                //else {
                    fElemMap[fElemMapSize].setValues(element);
                //}
                fElemMapType[fElemMapSize] = fLeafListType[outIndex];
                fElemMapSize++;
            }
        }
        // set up the fLeafNameTypeVector object if there is one.
        if (fLeafNameTypeVector != null) {
            fLeafNameTypeVector.setValues(fElemMap, fElemMapType, fElemMapSize);
        }

  /***
  * Optimization(Jan, 2001); We sort fLeafList according to
  * elemIndex which is *uniquely* associated to each leaf. 
  * We are *assuming* that each element appears in at least one leaf.
  **/

  int[] fLeafSorter = new int[fLeafCount + fElemMapSize];
  int fSortCount = 0;

  for (int elemIndex = 0; elemIndex < fElemMapSize; elemIndex++) {
      for (int leafIndex = 0; leafIndex < fLeafCount; leafIndex++) {
    final QName leaf = fLeafList[leafIndex].getElement();
    final int leafType = fLeafListType[leafIndex];
    final QName element = fElemMap[elemIndex];
    if (fDTD) {
        if (leaf.rawname == element.rawname) {
        fLeafSorter[fSortCount++] = leafIndex;
        }
    }
View Full Code Here

        // Recurse as required
        if ((nodeCur.type() & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY ||
            (nodeCur.type() & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY_LOCAL ||
            (nodeCur.type() & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY_OTHER) {
            // REVISIT: Don't waste these structures.
      QName qname = new QName(-1, -1, -1, ((CMAny)nodeCur).getURI());
            fLeafList[curIndex] = new CMLeaf(qname, ((CMAny)nodeCur).getPosition());
            fLeafListType[curIndex] = nodeCur.type();
            curIndex++;
        }
        else if ((nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_CHOICE)
        ||  (nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_SEQ))
        {
            curIndex = postTreeBuildInit(((CMBinOp)nodeCur).getLeft(), curIndex);
            curIndex = postTreeBuildInit(((CMBinOp)nodeCur).getRight(), curIndex);
        }
         else if (nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_MORE
       || nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_ONE_OR_MORE
       || nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_ONE)
        {
            curIndex = postTreeBuildInit(((CMUniOp)nodeCur).getChild(), curIndex);
        }
         else if (nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_LEAF)
        {
            //
            //  Put this node in the leaf list at the current index if its
            //  a non-epsilon leaf.
            //
             final QName node = ((CMLeaf)nodeCur).getElement();
            if (node.localpart != fEpsilonIndex) {
                fLeafList[curIndex] = (CMLeaf)nodeCur;
                fLeafListType[curIndex] = XMLContentSpec.CONTENTSPECNODE_LEAF;
                curIndex++;
            }
View Full Code Here

    // check whether two elements conflict
    private static boolean conflic(int type1, int local1, int uri1,
                                   int type2, int local2, int uri2,
                                   SubstitutionGroupComparator comparator) {
        QName q1 = new QName(), q2 = new QName();
        q1.localpart = local1;
        q1.uri = uri1;
        q2.localpart = local2;
        q2.uri = uri2;
View Full Code Here

        // Make our own copy now, which is exactly the right size
        fCount = length;
        fChildren = new QName[fCount];
        fChildrenType = new int[fCount];
        for (int i = 0; i < fCount; i++) {
            fChildren[i] = new QName(childList[offset + i]);
            fChildrenType[i] = childListType[offset + i];
        }
        fOrdered = ordered;

        fDTD = dtd;
View Full Code Here

        if (fOrdered) {
            int inIndex = 0;
            for (int outIndex = 0; outIndex < length; outIndex++) {

                // ignore mixed text
                final QName curChild = children[offset + outIndex];
                if (curChild.localpart == -1) {
                    continue;
                }

                // element must match
                int type = fChildrenType[inIndex];
                if (type == XMLContentSpec.CONTENTSPECNODE_LEAF) {
                    if (fDTD) {
                        if (fChildren[inIndex].rawname != children[offset + outIndex].rawname) {
                            return outIndex;
                        }
                    }
                    else {
                        if (fChildren[inIndex].uri != children[offset + outIndex].uri &&
                            fChildren[inIndex].localpart != children[offset + outIndex].localpart) {
                            return outIndex;
                        }
                    }
                }
                else if (type == XMLContentSpec.CONTENTSPECNODE_ANY) {
                    int uri = fChildren[inIndex].uri;
                    if (uri != StringPool.EMPTY_STRING && uri != children[outIndex].uri) {
                        return outIndex;
                    }
                }
                else if (type == XMLContentSpec.CONTENTSPECNODE_ANY_LOCAL) {
                    if (children[outIndex].uri != StringPool.EMPTY_STRING) {
                        return outIndex;
                    }
                }
                else if (type == XMLContentSpec.CONTENTSPECNODE_ANY_OTHER) {
                    if (fChildren[inIndex].uri == children[outIndex].uri) {
                        return outIndex;
                    }
                }
               
                // advance index
                inIndex++;
            }
        }

        // can appear in any order
        else {
            for (int outIndex = 0; outIndex < length; outIndex++)
            {
                // Get the current child out of the source index
                final QName curChild = children[offset + outIndex];
   
                // If its PCDATA, then we just accept that
                if (curChild.localpart == -1)
                    continue;
   
View Full Code Here

        if ((info.possibleChildren == null)
        ||  (info.possibleChildren.length < info.resultsCount))
        {
            info.possibleChildren = new QName[info.resultsCount];
            for (int i = 0; i < info.possibleChildren.length; i++) {
                info.possibleChildren[i] = new QName();
            }
        }

        //
        //  If the fully valid parameter is set, then whether any child can
View Full Code Here

            System.out.println("Entering AllContentModel#addElement");
        }

        // Need to resize arrays?
        if (fNumElements < fAllElements.length) {
            QName newAllElements[] = new QName[2*fAllElements.length];
            boolean newIsOptionalElements[] =
                                      new boolean[2*fIsOptionalElement.length];

            System.arraycopy(fAllElements, 0, newAllElements, 0,
                             fAllElements.length);
View Full Code Here

        // elements or elements that aren't permitted.
        boolean elementSeen[] = new boolean[numElements];
        int numRequiredSeen = 0;

        for (int childIndex = 0; childIndex < length; childIndex++) {
            QName currChild = children[offset + childIndex];

            // Skip text node if in mixed mode.
            if (fIsMixed && currChild.localpart == -1)
                continue;
View Full Code Here

TOP

Related Classes of org.apache.xerces.utils.QName

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.