View RSS Feed

Recent Blogs Posts

  1. DOM Element Attributes

    by , 04-27-2012 at 06:12 PM
    As you have already seen, you can access the attributes of an element via the Element interface. There are two ways to do so:
    Java Code:
    String attrValue = element.getAttribute("attrName");
    Attr attribute = element.getAttributeNode("attrName");
    Most of the time the getAttribute() method will do just fine.
    The Attr interface extends Node. It allows you to access the owning element via the methodgetOwnerElement() etc. Accessing an attribute via ...