Search in sources :

Example 1 with HTMLAllCollection

use of org.loboevolution.html.dom.HTMLAllCollection in project LoboEvolution by LoboEvolution.

the class HTMLAllCollectionImpl method tags.

/**
 * Returns all tags by name.
 *
 * @param tag the name of tag
 * @return a {@link HTMLAllCollection} object.
 */
@Override
public HTMLAllCollection tags(String tag) {
    final Document doc = this.rootNode.getOwnerDocument();
    if (doc == null) {
        return null;
    }
    final HTMLAllCollection list = (HTMLAllCollection) doc.getElementsByTagName(tag);
    if (list.getLength() == 0) {
        throw new DOMException(DOMException.NOT_FOUND_ERR, "is not a valid tag name.");
    }
    return list;
}
Also used : DOMException(com.gargoylesoftware.css.dom.DOMException) HTMLAllCollection(org.loboevolution.html.dom.HTMLAllCollection) Document(org.loboevolution.html.node.Document)

Aggregations

DOMException (com.gargoylesoftware.css.dom.DOMException)1 HTMLAllCollection (org.loboevolution.html.dom.HTMLAllCollection)1 Document (org.loboevolution.html.node.Document)1