/** * Calling this method before {@link #checkNsDefaults} is necessary * to pass information regarding the current element; although * it will become available later on (via normal XMLValidator interface), * that's too late (after namespace binding and resolving). */ public boolean mayHaveNsDefaults(String elemPrefix, String elemLN) { mTmpKey.reset(elemPrefix, elemLN); DTDElement elem = (DTDElement) mElemSpecs.get(mTmpKey); mCurrElem = elem; return (elem != null) && elem.hasNsDefaults(); }
/** * Method used to 'intern()' qualified names; main benefit is reduced * memory usage as the name objects are shared. May also slightly * speed up Map access, as more often identity comparisons catch * matches. *<p> * Note: it is assumed at this point that access is only from a single * thread, and non-recursive -- generally valid assumption as readers are * not shared. Restriction is needed since the method is not re-entrant: * it uses mAccessKey during the method call. */ private PrefixedName findSharedName(String prefix, String localName) { HashMap m = mSharedNames; if (mSharedNames == null) { mSharedNames = m = new HashMap(); } else { // Maybe we already have a shared instance... ? PrefixedName key = mAccessKey; key.reset(prefix, localName); key = (PrefixedName) m.get(key); if (key != null) { // gotcha return key; } } // Not found; let's create, cache and return it: PrefixedName result = new PrefixedName(prefix, localName); m.put(result, result); return result; }
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 }
mTmpKey.reset(prefix, localName); DTDElement elem = (DTDElement) mElemSpecs.get(mTmpKey);
DTDAttribute attr = (DTDAttribute) mCurrAttrDefs.get(mTmpKey.reset(prefix, localName)); int index = mAttrCount++; if (index >= mAttrSpecs.length) {
throws XMLStreamException DTDAttribute attr = (DTDAttribute) mCurrAttrDefs.get(mTmpKey.reset(prefix, localName)); if (attr == null) {
throws XMLStreamException DTDAttribute attr = (DTDAttribute) mCurrAttrDefs.get(mTmpKey.reset(prefix, localName)); if (attr == null) {
mTmpKey.reset(prefix, localName);
/** * Calling this method before {@link #checkNsDefaults} is necessary * to pass information regarding the current element; although * it will become available later on (via normal XMLValidator interface), * that's too late (after namespace binding and resolving). */ public boolean mayHaveNsDefaults(String elemPrefix, String elemLN) { mTmpKey.reset(elemPrefix, elemLN); DTDElement elem = (DTDElement) mElemSpecs.get(mTmpKey); mCurrElem = elem; return (elem != null) && elem.hasNsDefaults(); }
/** * Calling this method before {@link #checkNsDefaults} is necessary * to pass information regarding the current element; although * it will become available later on (via normal XMLValidator interface), * that's too late (after namespace binding and resolving). */ @Override public boolean mayHaveNsDefaults(String elemPrefix, String elemLN) { mTmpKey.reset(elemPrefix, elemLN); DTDElement elem = mElemSpecs.get(mTmpKey); mCurrElem = elem; return (elem != null) && elem.hasNsDefaults(); }
/** * Calling this method before {@link #checkNsDefaults} is necessary * to pass information regarding the current element; although * it will become available later on (via normal XMLValidator interface), * that's too late (after namespace binding and resolving). */ @Override public boolean mayHaveNsDefaults(String elemPrefix, String elemLN) { mTmpKey.reset(elemPrefix, elemLN); DTDElement elem = mElemSpecs.get(mTmpKey); mCurrElem = elem; return (elem != null) && elem.hasNsDefaults(); }
/** * Calling this method before {@link #checkNsDefaults} is necessary * to pass information regarding the current element; although * it will become available later on (via normal XMLValidator interface), * that's too late (after namespace binding and resolving). */ @Override public boolean mayHaveNsDefaults(String elemPrefix, String elemLN) { mTmpKey.reset(elemPrefix, elemLN); DTDElement elem = mElemSpecs.get(mTmpKey); mCurrElem = elem; return (elem != null) && elem.hasNsDefaults(); }
/** * Method used to 'intern()' qualified names; main benefit is reduced * memory usage as the name objects are shared. May also slightly * speed up Map access, as more often identity comparisons catch * matches. *<p> * Note: it is assumed at this point that access is only from a single * thread, and non-recursive -- generally valid assumption as readers are * not shared. Restriction is needed since the method is not re-entrant: * it uses mAccessKey during the method call. */ private PrefixedName findSharedName(String prefix, String localName) { HashMap<PrefixedName,PrefixedName> m = mSharedNames; if (mSharedNames == null) { mSharedNames = m = new HashMap<PrefixedName,PrefixedName>(); } else { // Maybe we already have a shared instance... ? PrefixedName key = mAccessKey; key.reset(prefix, localName); key = m.get(key); if (key != null) { // gotcha return key; } } // Not found; let's create, cache and return it: PrefixedName result = new PrefixedName(prefix, localName); m.put(result, result); return result; }
/** * Method used to 'intern()' qualified names; main benefit is reduced * memory usage as the name objects are shared. May also slightly * speed up Map access, as more often identity comparisons catch * matches. *<p> * Note: it is assumed at this point that access is only from a single * thread, and non-recursive -- generally valid assumption as readers are * not shared. Restriction is needed since the method is not re-entrant: * it uses mAccessKey during the method call. */ private PrefixedName findSharedName(String prefix, String localName) { HashMap<PrefixedName,PrefixedName> m = mSharedNames; if (mSharedNames == null) { mSharedNames = m = new HashMap<PrefixedName,PrefixedName>(); } else { // Maybe we already have a shared instance... ? PrefixedName key = mAccessKey; key.reset(prefix, localName); key = m.get(key); if (key != null) { // gotcha return key; } } // Not found; let's create, cache and return it: PrefixedName result = new PrefixedName(prefix, localName); m.put(result, result); return result; }
/** * Method used to 'intern()' qualified names; main benefit is reduced * memory usage as the name objects are shared. May also slightly * speed up Map access, as more often identity comparisons catch * matches. *<p> * Note: it is assumed at this point that access is only from a single * thread, and non-recursive -- generally valid assumption as readers are * not shared. Restriction is needed since the method is not re-entrant: * it uses mAccessKey during the method call. */ private PrefixedName findSharedName(String prefix, String localName) { HashMap<PrefixedName,PrefixedName> m = mSharedNames; if (mSharedNames == null) { mSharedNames = m = new HashMap<PrefixedName,PrefixedName>(); } else { // Maybe we already have a shared instance... ? PrefixedName key = mAccessKey; key.reset(prefix, localName); key = m.get(key); if (key != null) { // gotcha return key; } } // Not found; let's create, cache and return it: PrefixedName result = new PrefixedName(prefix, localName); m.put(result, result); return result; }
/** * Method used to 'intern()' qualified names; main benefit is reduced * memory usage as the name objects are shared. May also slightly * speed up Map access, as more often identity comparisons catch * matches. *<p> * Note: it is assumed at this point that access is only from a single * thread, and non-recursive -- generally valid assumption as readers are * not shared. Restriction is needed since the method is not re-entrant: * it uses mAccessKey during the method call. */ private PrefixedName findSharedName(String prefix, String localName) { HashMap m = mSharedNames; if (mSharedNames == null) { mSharedNames = m = new HashMap(); } else { // Maybe we already have a shared instance... ? PrefixedName key = mAccessKey; key.reset(prefix, localName); key = (PrefixedName) m.get(key); if (key != null) { // gotcha return key; } } // Not found; let's create, cache and return it: PrefixedName result = new PrefixedName(prefix, localName); m.put(result, result); return result; }
@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 }
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 }
@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 }
@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 }