if (elem == null || !elem.isDefined()) { reportValidationProblem(ErrorConsts.ERR_VLD_UNKNOWN_ELEM, mTmpKey.toString()); String msg = pv.tryToValidate(elem.getName()); if (msg != null) { int ix = msg.indexOf("$END"); String pname = mElems[elemCount-1].toString(); if (ix >= 0) { msg = msg.substring(0, ix) + "</"+pname+">" +elem.getName()+"> as a child of <" +pname+">: "+msg); mCurrSpecialAttrs = null; } else { mValidators[elemCount] = elem.getValidator(); mCurrAttrDefs = elem.getAttributes(); if (mCurrAttrDefs == null) { mCurrAttrDefs = EMPTY_MAP; mCurrHasAnyFixed = elem.hasFixedAttrs(); int specCount = elem.getSpecialCount(); if (specCount == 0) { mCurrSpecialAttrs = null;
/** * Method called on placeholder element, to create a real instance that * has all attribute definitions placeholder had (it'll always have at * least one -- otherwise no placeholder was needed). */ public DTDElement define(Location loc, StructValidator val, int allowedContent) { verifyUndefined(); if (allowedContent == XMLValidator.CONTENT_ALLOW_UNDEFINED) { // sanity check ExceptionUtil.throwInternal("trying to use CONTENT_ALLOW_UNDEFINED via define()"); } DTDElement elem = new DTDElement(loc, mName, val, allowedContent, mNsAware, mXml11); // Ok, need to copy state collected so far: elem.mAttrMap = mAttrMap; elem.mSpecAttrList = mSpecAttrList; elem.mAnyFixed = mAnyFixed; elem.mValidateAttrs = mValidateAttrs; elem.mAnyDefaults = mAnyDefaults; elem.mIdAttr = mIdAttr; elem.mNotationAttr = mNotationAttr; elem.mNsDefaults = mNsDefaults; return elem; }
mCurrAttrDefs = elem.getAttributes(); if (mCurrAttrDefs == null) { mCurrAttrDefs = EMPTY_MAP; mHasNormalizableAttrs = mNormAttrs || elem.attrsNeedValidation(); mHasAttrDefaults = elem.hasAttrDefaultValues(); if (mHasAttrDefaults) { int specCount = elem.getSpecialCount(); BitSet bs = mTmpDefaultAttrs; if (bs == null) {
if (extElem.isDefined()) { // one from the ext subset if (intElem.isDefined()) { // but both can't be; that's an error throwElementException(intElem, extElem.getLocation()); } else { intElem.defineFrom(rep, extElem, mFullyValidating); if (!intElem.isDefined()) { rep.reportProblem(intElem.getLocation(), ErrorConsts.WT_ENT_DECL, ErrorConsts.W_UNDEFINED_ELEM, extElem.getDisplayName(), null); intElem.mergeMissingAttributesFrom(rep, extElem, mFullyValidating);
throws XMLStreamException Map otherMap = other.getAttributes(); HashMap m = mAttrMap; if (m == null) { specList = getSpecialList(); newAttr = newAttr.cloneWith(specList.size()); } else { specList = null; doAddAttribute(m, rep, newAttr, specList, fullyValidate);
if (oldElem.isDefined()) { // oops, a problem! oldElem = oldElem.define(loc, val, vldContent); } else { oldElem = DTDElement.createDefined(mConfig, loc, elemName, val, vldContent);
List specList = defValue.isSpecial() ? getSpecialList() : null; DTDAttribute old = doAddAttribute(m, rep, attr, specList, fullyValidate); return (old == null) ? attr : null;
attr = elem.addNsDefault(this, attrName, type, defVal, mCfgFullyValidating); } else { attr = elem.addAttribute(this, attrName, type, defVal, enumValues, mCfgFullyValidating);
/** * Method called to create a "placeholder" element definition, needed to * contain attribute definitions. */ public static DTDElement createPlaceholder(ReaderConfig cfg, Location loc, PrefixedName name) { return new DTDElement(loc, name, null, XMLValidator.CONTENT_ALLOW_UNDEFINED, cfg.willSupportNamespaces(), cfg.isXml11()); }
/** * Name of current element on the top of the element stack. */ PrefixedName getElemName() { DTDElement elem = mElems[mElemCount-1]; return elem.getName(); }
elem = DTDElement.createPlaceholder(mConfig, loc, elemName); m.put(elemName, elem);
if (extElem.isDefined()) { // one from the ext subset if (intElem.isDefined()) { // but both can't be; that's an error throwElementException(intElem, extElem.getLocation()); } else { intElem.defineFrom(rep, extElem, mFullyValidating); if (!intElem.isDefined()) { rep.reportProblem(intElem.getLocation(), ErrorConsts.WT_ENT_DECL, ErrorConsts.W_UNDEFINED_ELEM, extElem.getDisplayName(), null); intElem.mergeMissingAttributesFrom(rep, extElem, mFullyValidating);
throws XMLStreamException Map<PrefixedName,DTDAttribute> otherMap = other.getAttributes(); HashMap<PrefixedName,DTDAttribute> m = mAttrMap; if (m == null) { specList = getSpecialList(); newAttr = newAttr.cloneWith(specList.size()); } else { specList = null; doAddAttribute(m, rep, newAttr, specList, fullyValidate);
if (oldElem.isDefined()) { // oops, a problem! oldElem = oldElem.define(loc, val, vldContent); } else { oldElem = DTDElement.createDefined(mConfig, loc, elemName, val, vldContent);
List specList = defValue.isSpecial() ? getSpecialList() : null; DTDAttribute old = doAddAttribute(m, rep, attr, specList, fullyValidate); return (old == null) ? attr : null;
attr = elem.addNsDefault(this, attrName, type, defVal, mCfgFullyValidating); } else { attr = elem.addAttribute(this, attrName, type, defVal, enumValues, mCfgFullyValidating);
/** * Method called to create an actual element definition, matching * an ELEMENT directive in a DTD subset. */ public static DTDElement createDefined(ReaderConfig cfg, Location loc, PrefixedName name, StructValidator val, int allowedContent) { if (allowedContent == XMLValidator.CONTENT_ALLOW_UNDEFINED) { // sanity check ExceptionUtil.throwInternal("trying to use XMLValidator.CONTENT_ALLOW_UNDEFINED via createDefined()"); } return new DTDElement(loc, name, val, allowedContent, cfg.willSupportNamespaces(), cfg.isXml11()); }
/** * Name of current element on the top of the element stack. */ PrefixedName getElemName() { DTDElement elem = mElems[mElemCount-1]; return elem.getName(); }
elem = DTDElement.createPlaceholder(mConfig, loc, elemName); m.put(elemName, elem);
if (elem == null || !elem.isDefined()) { reportValidationProblem(ErrorConsts.ERR_VLD_UNKNOWN_ELEM, mTmpKey.toString()); String msg = pv.tryToValidate(elem.getName()); if (msg != null) { int ix = msg.indexOf("$END"); String pname = mElems[elemCount-1].toString(); if (ix >= 0) { msg = msg.substring(0, ix) + "</"+pname+">" +elem.getName()+"> as a child of <" +pname+">: "+msg); mCurrSpecialAttrs = null; } else { mValidators[elemCount] = elem.getValidator(); mCurrAttrDefs = elem.getAttributes(); if (mCurrAttrDefs == null) { mCurrAttrDefs = EMPTY_MAP; mCurrHasAnyFixed = elem.hasFixedAttrs(); int specCount = elem.getSpecialCount(); if (specCount == 0) { mCurrSpecialAttrs = null;