Package com.ctc.wstx.util

Examples of com.ctc.wstx.util.PrefixedName


        Bucket[] buckets = null;
        int mask = (tableSize - 1);

        for (int i = 0; i < len; ++i) {
            PrefixedName nk = names[i];
            int ix = (nk.hashCode() & mask);
            if (mNames[ix] == null) { // no collision
                mNames[ix] = nk;
            } else { // collision, need to add a bucket
                ix >>= 2;
View Full Code Here


     */
    public boolean contains(PrefixedName name)
    {
        PrefixedName[] hashArea = mNames;
        int index = name.hashCode() & (hashArea.length - 1);
        PrefixedName res = hashArea[index];

        if (res != null && res.equals(name)) {
            return true;
        }

        Bucket[] buckets = mBuckets;
        if (buckets != null) {
            for (Bucket bucket = buckets[index >> 2]; bucket != null;
                 bucket = bucket.getNext()) {
                res = bucket.getName();
                if (res.equals(name)) {
                    return true;
                }
            }
        }
        return false;
View Full Code Here

    public void appendNames(StringBuilder sb, String sep)
    {
        // Let's first get the alphabetized list of all names from main hash
        TreeSet<PrefixedName> ts = new TreeSet<PrefixedName>();
        for (int i = 0; i < mNames.length; ++i) {
            PrefixedName name = mNames[i];
            if (name != null) {
                ts.add(name);
            }
        }
View Full Code Here

         */
        String def = attr.getDefaultValue(mContext, this);
        if (def == null) {
            ExceptionUtil.throwInternal("null default attribute value");
        }
        PrefixedName an = attr.getName();
        // Ok, do we need to find the URI?
        String prefix = an.getPrefix();
        String uri = "";
        if (prefix != null && prefix.length() > 0) {
            uri = mContext.getNamespaceURI(prefix);
            // Can not map to empty NS!
            if (uri == null || uri.length() == 0) {
                /* Hmmh. This is a weird case where we do have to
                 * throw a validity exception; even though it really
                 * is more a ns-well-formedness error...
                 */
                reportValidationProblem("Unbound namespace prefix \"{0}\" for default attribute \"{1}\"", prefix, attr);
                // May continue if we don't throw errors, just collect them to a list
                uri = "";
            }
        }
        int defIx = mContext.addDefaultAttribute(an.getLocalName(), uri, prefix, def);
        if (defIx < 0) {
            /* 13-Dec-2005, Tatus: Hmmh. For readers this is an error
             *   condition, but writers may just indicate they are not
             *   interested in defaults. So let's let context report
             *   problem(s) if it has any regarding the request.
View Full Code Here

        BitSet tokenSet = (BitSet) mTokenSet.clone();
        // No need to keep the reference to it, though:
        mTokenSet = null;

        while ((first = tokenSet.nextSetBit(first+1)) >= 0) {
            PrefixedName tokenName = tokenNames[first];

            /* Special case; the dummy end token has null as name;
             * we can skip that one:
             */
            if (tokenName == null) {
View Full Code Here

        if (len == 0) { // sanity check
            throw new IllegalStateException("Trying to construct empty PrefixedNameSet");
        }
        mStrings = new String[nsAware ? (len+len) : len];
        for (int out = 0, in = 0; in < len; ++in) {
            PrefixedName nk = names[in];
            if (nsAware) {
                mStrings[out++] = nk.getPrefix();
            }
            mStrings[out++] = nk.getLocalName();
        }
    }
View Full Code Here

            mIdDefs = new ElementIdMap();
        }

        int idType = datatype.getIdType();
        Location loc = mContext.getValidationLocation();
        PrefixedName elemPName = getElementPName();
        PrefixedName attrPName = getAttrPName();

        if (idType == Datatype.ID_TYPE_ID) {
            String idStr = idToken.literal.trim();
            ElementId eid = mIdDefs.addDefined(idStr, loc, elemPName, attrPName);
            // We can detect dups by checking if Location is the one we passed:
View Full Code Here

            hash = (hash * 31) + (int) c;
        }

        // Either way, we do need to validate characters, and calculate hash
        ElementIdMap m = v.getIdMap();
        PrefixedName elemName = v.getElemName();
        Location loc = v.getLocation();
        ElementId id = m.addDefined(cbuf, start, (end - start + 1), hash,
                                    loc, elemName, mName);

        // We can detect dups by checking if Location is the one we passed:
View Full Code Here

                    return "was not expecting any more elements in the sequence ("
                        +concatNames(mNames)+")";
                }
            }

            PrefixedName next = mNames[mStep];
            if (!elemName.equals(next)) {
                return expElem(mStep);
            }
            if (++mStep == mNames.length) {
                ++mRounds;
View Full Code Here

     */
    private void combineElements(InputProblemReporter rep, HashMap<PrefixedName,DTDElement> intElems, HashMap<PrefixedName,DTDElement> extElems)
        throws XMLStreamException
    {
      for (Map.Entry<PrefixedName,DTDElement> me : extElems.entrySet()) {
            PrefixedName key = me.getKey();
            DTDElement extElem = me.getValue();
            DTDElement intElem = intElems.get(key);

            // If there was no old value, can just merge new one in and continue
            if (intElem == null) {
View Full Code Here

TOP

Related Classes of com.ctc.wstx.util.PrefixedName

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.