Package com.ctc.wstx.util

Examples of com.ctc.wstx.util.ElementId


        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:
            if (eid.getLocation() != loc) {
                mProblem = new XMLValidationProblem(loc, "Duplicate id '"+idStr+"', first declared at "+eid.getLocation());
                mProblem.setReporter(this);
            }
        } else if (idType == Datatype.ID_TYPE_IDREF) {
            String idStr = idToken.literal.trim();
            mIdDefs.addReferenced(idStr, loc, elemPName, attrPName);
View Full Code Here


         * IDREF/IDREFS references. But only if we hit EOF, not
         * if validation was cancelled.
         */
        if (eod) {
            if (mIdDefs != null) {
                ElementId ref = mIdDefs.getFirstUndefined();
                if (ref != null) { // problem!
                    String msg = "Undefined ID '"+ref.getId()
                        +"': referenced from element <"
                        +ref.getElemName()+">, attribute '"
                        +ref.getAttrName()+"'";
                    reportError(msg, ref.getLocation());
                }
            }
        }
    }
View Full Code Here

    {
        /* 02-Oct-2004, TSa: Now we can also check that all id references
         *    pointed to ids that actually are defined
         */
        if (mIdMap != null) {
            ElementId ref = mIdMap.getFirstUndefined();
            if (ref != null) { // problem!
                reportValidationProblem("Undefined id '"+ref.getId()
                                        +"': referenced from element <"
                                        +ref.getElemName()+">, attribute '"
                                        +ref.getAttrName()+"'",
                                        ref.getLocation());
            }
        }
    }
View Full Code Here

        // 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:
        if (id.getLocation() != loc) {
            return reportValidationProblem(v, "Duplicate id '"+id.getId()+"', first declared at "
                                           +id.getLocation());
        }

        if (normalize) {
            return id.getId();
        }
        return null;
    }
View Full Code Here

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

            // Ok, got the next id ref...
            ElementId id = m.addReferenced(cbuf, start, i - start, hash,
                                           loc, v.getElemName(), mName);
           
            // Can skip the trailing space char (if there was one)
            start = i+1;

            /* When normalizing, we can possibly share id String, or
             * alternatively, compose normalized String if multiple
             */
            if (normalize) {
                if (idStr == null) { // first idref
                    idStr = id.getId();
                } else {
                    if (sb == null) {
                        sb = new StringBuilder(idStr);
                    }
                    idStr = id.getId();
                    sb.append(' ');
                    sb.append(idStr);
                }
            }

View Full Code Here

        }

        // Ok, let's check and update id ref list...
        ElementIdMap m = v.getIdMap();
        Location loc = v.getLocation();
        ElementId id = m.addReferenced(cbuf, start, (end - start + 1), hash,
                                       loc, v.getElemName(), mName);
        // and that's all; no more checks needed here
        return normalize ? id.getId() : null;
    }
View Full Code Here

        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:
            if (eid.getLocation() != loc) {
                mProblem = new XMLValidationProblem(loc, "Duplicate id '"+idStr+"', first declared at "+eid.getLocation());
                mProblem.setReporter(this);
            }
        } else if (idType == Datatype.ID_TYPE_IDREF) {
            String idStr = idToken.literal.trim();
            mIdDefs.addReferenced(idStr, loc, elemPName, attrPName);
View Full Code Here

         * IDREF/IDREFS references. But only if we hit EOF, not
         * if validation was cancelled.
         */
        if (eod) {
            if (mIdDefs != null) {
                ElementId ref = mIdDefs.getFirstUndefined();
                if (ref != null) { // problem!
                    String msg = "Undefined ID '"+ref.getId()
                        +"': referenced from element <"
                        +ref.getElemName()+">, attribute '"
                        +ref.getAttrName()+"'";
                    reportError(msg, ref.getLocation());
                }
            }
        }
    }
View Full Code Here

    {
        /* 02-Oct-2004, TSa: Now we can also check that all id references
         *    pointed to ids that actually are defined
         */
        if (mIdMap != null) {
            ElementId ref = mIdMap.getFirstUndefined();
            if (ref != null) { // problem!
                reportValidationProblem("Undefined id '"+ref.getId()
                                        +"': referenced from element <"
                                        +ref.getElemName()+">, attribute '"
                                        +ref.getAttrName()+"'",
                                        ref.getLocation());
            }
        }
    }
View Full Code Here

        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:
            if (eid.getLocation() != loc) {
                mProblem = new XMLValidationProblem(loc, "Duplicate id '"+idStr+"', first declared at "+eid.getLocation());
                mProblem.setReporter(this);
            }
        } else if (idType == Datatype.ID_TYPE_IDREF) {
            String idStr = idToken.literal.trim();
            mIdDefs.addReferenced(idStr, loc, elemPName, attrPName);
View Full Code Here

TOP

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

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.