Attr Interface
We introduced the Attribute interface in the previous section, and we saw the use of the Attribute interface in Listing 3.5. We should now examine the Attribute interface in detail. Attributes, represented by the java interface Attr, allow for creating, examining, and otherwise manipulating the XML representation of attributes via the DOM. Attributes are not part of the DOM tree per se. They are never children of any given node but must be acted on specifically by calling one of the get/set attribute methods on an element. As a result, getPreviousSibling, getParent, and getNextSibling methods return null. In short, attributes are properties of nodes, are owned by a node, but are not children of nodes. One further note—while Attribute ...
Get XML Development with Java™ 2 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.