Name
specified: boolean
Synopsis
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.
Java binding
public boolean getSpecified( );
Java example
// 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( )); } }
Get XML in a Nutshell, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.