int specIndex = attr.getSpecialIndex(); if (specIndex >= 0) { mCurrSpecialAttrs.set(specIndex); String result = attr.validate(this, value, mNormAttrs); if (mCurrHasAnyFixed && attr.isFixed()) { String act = (result == null) ? value : result; String exp = attr.getDefaultValue(mContext, this); if (!act.equals(exp)) { reportValidationProblem("Value of attribute \""+attr+"\" (element <"+mCurrElem+">) not \""+exp+"\" as expected, but \""+act+"\"");
throws XMLStreamException PrefixedName attrName = attr.getName(); switch (attr.getValueType()) { case DTDAttribute.TYPE_ID: rep.throwParseError("Invalid id attribute \"{0}\" for element <{1}>: already had id attribute \""+mIdAttr.getName()+"\"", attrName, mName); rep.throwParseError("Invalid notation attribute '"+attrName+"' for element <"+mName+">: already had notation attribute '"+mNotationAttr.getName()+"'"); mAnyFixed = attr.isFixed(); mValidateAttrs = attr.needsValidation(); mAnyDefaults = attr.hasDefaultValue();
public String validateAttribute(String localName, String uri, String prefix, char[] valueChars, int valueStart, int valueEnd) throws XMLStreamException { // note: cut'n pasted from above... DTDAttribute attr = (DTDAttribute) mCurrAttrDefs.get(mTmpKey.reset(prefix, localName)); int index = mAttrCount++; if (index >= mAttrSpecs.length) { mAttrSpecs = (DTDAttribute[]) DataUtil.growArrayBy50Pct(mAttrSpecs); } mAttrSpecs[index] = attr; if (attr != null) { if (mHasAttrDefaults) { int specIndex = attr.getSpecialIndex(); if (specIndex >= 0) { mCurrDefaultAttrs.set(specIndex); } } if (mHasNormalizableAttrs) { // may get normalized, after all return attr.normalize(this, valueChars, valueStart, valueEnd); } } return null; // fine as is }
String def = attr.getDefaultValue(mContext, this); if (def == null) { ExceptionUtil.throwInternal("null default attribute value"); PrefixedName an = attr.getName();
public String getValueTypeString() { return sTypes[getValueType()]; }
public String getAttributeType(int index) { DTDAttribute attr = mAttrSpecs[index]; return (attr == null) ? WstxInputProperties.UNKNOWN_ATTR_TYPE : attr.getValueTypeString(); }
public void checkNsDefaults(InputElementStack nsStack) throws XMLStreamException { // We only get called if mCurrElem != null, and has defaults HashMap m = mCurrElem.getNsDefaults(); if (m != null) { Iterator it = m.entrySet().iterator(); while (it.hasNext()) { Map.Entry me = (Map.Entry) it.next(); String prefix = (String) me.getKey(); if (!nsStack.isPrefixLocallyDeclared(prefix)) { DTDAttribute attr = (DTDAttribute) me.getValue(); String uri = attr.getDefaultValue(mContext, this); nsStack.addNsBinding(prefix, uri); } } } }
if (attr.isRequired()) { reportValidationProblem("Required attribute \"{0}\" missing from element <{1}>", attr, elem); } else {
List specAttrs = elem.getSpecialAttrs(); DTDAttribute attr = (DTDAttribute) specAttrs.get(ix); if (attr.hasDefaultValue()) { // no default for #REQUIRED... doAddDefaultValue(attr);
int specIndex = attr.getSpecialIndex(); if (specIndex >= 0) { mCurrDefaultAttrs.set(specIndex);
@Override public String validateAttribute(String localName, String uri, String prefix, char[] valueChars, int valueStart, int valueEnd) throws XMLStreamException { // note: cut'n pasted from above... DTDAttribute attr = mCurrAttrDefs.get(mTmpKey.reset(prefix, localName)); int index = mAttrCount++; if (index >= mAttrSpecs.length) { mAttrSpecs = (DTDAttribute[]) DataUtil.growArrayBy50Pct(mAttrSpecs); } mAttrSpecs[index] = attr; if (attr != null) { if (mHasAttrDefaults) { int specIndex = attr.getSpecialIndex(); if (specIndex >= 0) { mCurrDefaultAttrs.set(specIndex); } } if (mHasNormalizableAttrs) { // may get normalized, after all return attr.normalize(this, valueChars, valueStart, valueEnd); } } return null; // fine as is }
String def = attr.getDefaultValue(mContext, this); if (def == null) { ExceptionUtil.throwInternal("null default attribute value"); PrefixedName an = attr.getName();
public final boolean needsValidation() { return (getValueType() != TYPE_CDATA); }
public String getAttributeType(int index) { DTDAttribute attr = mAttrSpecs[index]; return (attr == null) ? WstxInputProperties.UNKNOWN_ATTR_TYPE : attr.getValueTypeString(); }
public void checkNsDefaults(InputElementStack nsStack) throws XMLValidationException { // We only get called if mCurrElem != null, and has defaults HashMap m = mCurrElem.getNsDefaults(); if (m != null) { Iterator it = m.entrySet().iterator(); while (it.hasNext()) { Map.Entry me = (Map.Entry) it.next(); String prefix = (String) me.getKey(); if (!nsStack.isPrefixLocallyDeclared(prefix)) { DTDAttribute attr = (DTDAttribute) me.getValue(); String uri = attr.getDefaultValue(mContext); nsStack.addNsBinding(prefix, uri); } } } }
if (attr.isRequired()) { reportValidationProblem("Required attribute \"{0}\" missing from element <{1}>", attr, elem); } else {
List specAttrs = elem.getSpecialAttrs(); DTDAttribute attr = (DTDAttribute) specAttrs.get(ix); if (attr.hasDefaultValue()) { // no default for #REQUIRED... doAddDefaultValue(attr);
int specIndex = attr.getSpecialIndex(); if (specIndex >= 0) { mCurrDefaultAttrs.set(specIndex);
int specIndex = attr.getSpecialIndex(); if (specIndex >= 0) { mCurrSpecialAttrs.set(specIndex); String result = attr.validate(this, valueChars, valueStart, valueEnd, mNormAttrs); if (mCurrHasAnyFixed && attr.isFixed()) { String exp = attr.getDefaultValue(mContext, this); boolean match; if (result == null) {