Here you can find the source of getAttributes(final Element element)
Parameter | Description |
---|---|
element | the parent Element |
public static List<Attr> getAttributes(final Element element)
//package com.java2s; //License from project: Apache License import java.util.AbstractList; import java.util.List; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; public class Main { /**/*from www .j av a 2 s .co m*/ * Retrieves all {@link Attr Attribute}s from a given parent {@link Element} * as {@link List}. * * @param element * the parent {@link Element} * @return the {@link List} of {@link Attr Attribute}s */ public static List<Attr> getAttributes(final Element element) { final NamedNodeMap attributes = element.getAttributes(); return new AbstractList<Attr>() { @Override public Attr get(final int index) { return (Attr) attributes.item(index); } @Override public int size() { return attributes.getLength(); } }; } }