specified: boolean
This indicates whether this attribute was explicitly set in the XML source for the parent element or is a default value specified in the DTD or schema. Read-only.
// Dump element attribute names for (int i = 0; i < elem.getAttributes( ).getLength( ); i++) { // temporarily alias the attribute attr = (Attr)elem.getAttributes( ).item(i); // only show attributes that were explicitly included in the XML //source file // (i.e. ignore default attributes from the DTD.) if (attr.getSpecified( )) { System.out.println(attr.getName( )); } }