@@ -67,8 +67,9 @@ public XMLAttributesImpl(final XMLAttributesImpl attributes) {
6767 * marked as specified in the XML instance document unless set otherwise using
6868 * the <code>setSpecified</code> method.
6969 * <p>
70- * <strong>Note:</strong> If an attribute of the same name already exists, the
71- * old values for the attribute are replaced by the new values.
70+ * <strong>Note:</strong> This implementation does <em>not</em> check whether an
71+ * attribute of the same name already exists. If duplicate prevention is required,
72+ * the caller must verify uniqueness before calling this method.
7273 *
7374 * @param name The attribute name.
7475 * @param type The attribute type. The type name is determined by the type
@@ -122,14 +123,21 @@ public void addAttribute(final QName name, final String type, final String value
122123 }
123124
124125 /**
125- * Same as {@link #addAttribute(QName, String, String, String, boolean)} but with an additional
126- * nonNormalizedValue parameter
127- *
128- * @param name the attribute name
129- * @param type the attribute type
130- * @param value the attribute value
131- * @param nonNormalizedValue the non-normalized attribute value
132- * @param specified the specified attribute value
126+ * Adds an attribute together with its non-normalized (plain) value.
127+ * <p>
128+ * This variant stores both the normalized {@code value} and the original
129+ * {@code nonNormalizedValue} so that downstream consumers can access the
130+ * raw attribute text via {@link #getNonNormalizedValue(int)}.
131+ * <p>
132+ * Like the other {@code addAttribute} overloads, this method does
133+ * <em>not</em> check for duplicate attribute names.
134+ *
135+ * @param name the attribute name
136+ * @param type the attribute type (e.g. "CDATA")
137+ * @param value the normalized attribute value
138+ * @param nonNormalizedValue the original, non-normalized attribute value
139+ * @param specified {@code true} if the attribute was specified in the
140+ * instance document
133141 */
134142 public void addAttribute (final QName name , final String type , final String value ,
135143 final String nonNormalizedValue , final boolean specified ) {
@@ -328,22 +336,16 @@ public String getValue(final String qname) {
328336 }
329337
330338 /**
331- * Return the name of an attribute in this list (by position).
332- *
339+ * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span>
333340 * <p>
334- * The names must be unique: the SAX parser shall not include the same attribute
335- * twice. Attributes without values (those declared #IMPLIED without a value
336- * specified in the start tag) will be omitted from the list.
337- * </p>
338- *
339- * <p>
340- * If the attribute name has a namespace prefix, the prefix will still be
341- * attached.
342- * </p>
341+ * Returns the raw (prefixed) name of the attribute at the given index.
342+ * This is a convenience shortcut equivalent to
343+ * {@code getName(index).getRawname()} but with bounds checking.
343344 *
344345 * @param index The index of the attribute in the list (starting at 0).
345- * @return The name of the indexed attribute, or null if the index is out of
346- * range.
346+ * @return The raw name of the indexed attribute, or null if the index is
347+ * out of range.
348+ * @see #getQName(int)
347349 * @see #getLength
348350 */
349351 public String getNameRawName (final int index ) {
@@ -458,7 +460,7 @@ public String getType(final String uri, final String localName) {
458460 * Look up an attribute's Namespace URI by index.
459461 *
460462 * @param index The attribute index (zero-based).
461- * @return The Namespace URI
463+ * @return The Namespace URI, or null if the index is out of range.
462464 * @see #getLength
463465 */
464466 @ Override
@@ -477,7 +479,7 @@ public String getURI(final int index) {
477479 * values.
478480 * </p>
479481 *
480- * @param uri The Namespace URI, or null if the
482+ * @param uri The Namespace URI, or null if the name has no Namespace URI.
481483 * @param localName The local name of the attribute.
482484 * @return The attribute value as a string, or null if the attribute is not in
483485 * the list.
0 commit comments