public QName getQName(int index) { if (index < 0 || index >= mAttrCount) { throwIndex(index); } return mAttributes[index].getQName(); }
/** *<p> * Note: the main reason this method is defined at this level, and * made final, is performance. JIT may be able to fully inline this * method, even when reference is via this base class. This is important * since this is likely to be the most often called method of the * collector instances. */ public final String getValue(int index) { if (index < 0 || index >= mAttrCount) { throwIndex(index); } String full = mValueBuilder.getAllValues(); Attribute attr = mAttributes[index]; ++index; if (index < mAttrCount) { // not last int endOffset = mAttributes[index].mValueStartOffset; return attr.getValue(full, endOffset); } // last can be optimized bit more: return attr.getValue(full); }
/** * Low-level mutator method that attribute validation code may call * for certain types of attributes, when it wants to handle the whole * validation and normalization process by itself. It is generally * only called for id and idref/idrefs attributes, as those values * are usually normalized. */ public final void setNormalizedValue(int index, String value) { mAttributes[index].setValue(value); }
if (mAttributes[0].hasLocalName(localName)) return getValue(0); if (mAttributes[1].hasLocalName(localName)) return getValue(1); if (mAttributes[2].hasLocalName(localName)) return getValue(2); if (mAttributes[3].hasLocalName(localName)) return getValue(3); return null; case 3: if (mAttributes[0].hasLocalName(localName)) return getValue(0); if (mAttributes[1].hasLocalName(localName)) return getValue(1); if (mAttributes[2].hasLocalName(localName)) return getValue(2); return null; case 2: if (mAttributes[0].hasLocalName(localName)) return getValue(0); if (mAttributes[1].hasLocalName(localName)) return getValue(1); return null; case 1: if (mAttributes[0].hasLocalName(localName)) return getValue(0); return null; case 0: default: for (int i = 0, end = mAttrCount; i < end; ++i) { if (mAttributes[i].hasLocalName(localName)) { return getValue(i);
Attribute attr = mAttributes[mAttrCount-1]; attr.mNamespaceURI = uri; attr.setValue(value);
if (mAttributes[0].hasLocalName(localName)) return getValue(0); if (mAttributes[1].hasLocalName(localName)) return getValue(1); if (mAttributes[2].hasLocalName(localName)) return getValue(2); if (mAttributes[3].hasLocalName(localName)) return getValue(3); return null; case 3: if (mAttributes[0].hasLocalName(localName)) return getValue(0); if (mAttributes[1].hasLocalName(localName)) return getValue(1); if (mAttributes[2].hasLocalName(localName)) return getValue(2); return null; case 2: if (mAttributes[0].hasLocalName(localName)) return getValue(0); if (mAttributes[1].hasLocalName(localName)) return getValue(1); return null; case 1: if (mAttributes[0].hasLocalName(localName)) return getValue(0); return null; case 0: default: for (int i = 0, end = mAttrCount; i < end; ++i) { if (mAttributes[i].hasLocalName(localName)) { return getValue(i);
protected void validateAttribute(int index, XMLValidator vld) throws XMLStreamException { Attribute attr = mAttributes[index]; String normValue = vld.validateAttribute (attr.mLocalName, attr.mNamespaceURI, attr.mPrefix, mValueBuilder.getCharBuffer(), getValueStartOffset(index), getValueStartOffset(index+1)); if (normValue != null) { attr.setValue(normValue); } }
/** * Method called to resolve and initialize specified collected * namespace declaration * * @return Attribute that contains specified namespace declaration */ protected Attribute resolveNamespaceDecl(int index, boolean internURI) { Attribute ns = mNamespaces[index]; String full = mNamespaceBuilder.getAllValues(); String uri; if (mNsCount == 0) { uri = full; } else { ++index; if (index < mNsCount) { // not last int endOffset = mNamespaces[index].mValueStartOffset; uri = ns.getValue(full, endOffset); } else { // is last uri = ns.getValue(full); } } if (internURI && uri.length() > 0) { uri = sInternCache.intern(uri); } ns.mNamespaceURI = uri; return ns; }
public QName getQName(int index) { if (index < 0 || index >= mAttrCount) { throwIndex(index); } return mAttributes[index].getQName(); }
/** * Method that can be called to force space normalization (remove * leading/trailing spaces, replace non-spaces white space with * spaces, collapse spaces to one) on specified attribute. * Currently called by {@link InputElementStack} to force * normalization of Xml:id attribute */ public void normalizeSpacesInValue(int index) { // StringUtil has a method, but it works on char arrays... char[] attrCB = mValueBuilder.getCharBuffer(); String normValue = StringUtil.normalizeSpaces (attrCB, getValueStartOffset(index), getValueStartOffset(index+1)); if (normValue != null) { mAttributes[index].setValue(normValue); } }
/** *<p> * Note: the main reason this method is defined at this level, and * made final, is performance. JIT may be able to fully inline this * method, even when reference is via this base class. This is important * since this is likely to be the most often called method of the * collector instances. */ public final String getValue(int index) { if (index < 0 || index >= mAttrCount) { throwIndex(index); } String full = mValueBuilder.getAllValues(); Attribute attr = mAttributes[index]; ++index; if (index < mAttrCount) { // not last int endOffset = mAttributes[index].mValueStartOffset; return attr.getValue(full, endOffset); } // last can be optimized bit more: return attr.getValue(full); }
public QName getQName(int index) { if (index < 0 || index >= mAttrCount) { throwIndex(index); } return mAttributes[index].getQName(); }