O'Reilly logo

Java and XML by Brett McLaughlin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 is rumored to 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).[20] 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required