Java Swing HTML containsAttribute(Element element, Object name, Object value)

Here you can find the source of containsAttribute(Element element, Object name, Object value)

Description

contains Attribute

License

BSD License

Declaration

public static boolean containsAttribute(Element element, Object name, Object value) 

Method Source Code

//package com.java2s;
/**//from w w w  .  j a v  a  2s.co m
 * Kuebiko - SwingHtmlUtil.java
 * Copyright 2011 Dave Huffman (dave dot huffman at me dot com).
 * Open source under the BSD 3-Clause License.
 */

import javax.swing.text.Element;

public class Main {
    public static boolean containsAttribute(Element element, Object name, Object value) {
        if (element == null) {
            return false;
        }

        Object attribute = element.getAttributes().getAttribute(name);

        if (attribute == null) {
            return containsAttribute(element.getParentElement(), name, value);
        }
        return value.equals(attribute.toString());
    }
}

Related

  1. addToContentModels(DTD dtd, Element existing, Element alt)
  2. findElementDown(final String name, final Element parent)
  3. findElementUp(final String name1, final String name2, final Element start)
  4. findLinkElementUp(Element elem)
  5. findLinkUp(Element elem)