DOM Level 2
DOM
provides a complete, in-memory representation of an XML document.
Developed by the W3C, DOM provides detail about the structure of a
document after it has been completely parsed.
While DOM Level 3 will specify an API for getting the DOM
Document object, there is currently nothing in DOM
that defines this behavior. Like SAX, most of the core DOM package is
made up of interfaces that define structures within an XML document,
and map those structures to the Java language (these same mappings
apply to CORBA, JavaScript, and other languages as well).
Package: org.w3c.dom
This package contains the core interfaces and classes for DOM Level 2. Typically a vendor’s parsing software provides an implementation of those interfaces that are implicitly used by your application software.
Attr
This
interface represents an XML attribute (on an element) within Java. It
provides access to the name and value of the attribute, and allows
the setting of the value (for mutability).[29] The
getSpecified( ) method indicates if the attribute
(and its value) was explicitly noted in the XML document, or if a
value was not specified but the document’s DTD assigned a
default value to the attribute. Finally, the “owning”
element can be obtained from this interface.
public interface Attr extends Node {
public String getName( );
public boolean getSpecified( );
public String getValue( );
public void setValue(String value) throws DOMException;
public Element getOwnerElement( );
}CDATASection
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access