MCPcopy Create free account
hub / github.com/HtmlUnit/htmlunit / DomAttr

Class DomAttr

src/main/java/org/htmlunit/html/DomAttr.java:30–195  ·  view source on GitHub ↗

An attribute of an element. Attributes are stored in HtmlElement, but the XPath engine expects attributes to be in a DomNode. @author Denis N. Antonioli @author David K. Taylor @author Ahmed Ashour @author Ronald Brill

Source from the content-addressed store, hash-verified

28 * @author Ronald Brill
29 */
30public class DomAttr extends DomNamespaceNode implements Attr {
31
32 private String value_;
33 private boolean specified_;
34
35 /**
36 * Instantiate a new attribute.
37 *
38 * @param page the page that the attribute belongs to
39 * @param namespaceURI the namespace that defines the attribute name (maybe {@code null})
40 * @param qualifiedName the name of the attribute
41 * @param value the value of the attribute
42 * @param specified {@code true} if this attribute was explicitly given a value in the source document,
43 * or if the application changed the value of the attribute
44 */
45 public DomAttr(final SgmlPage page, final String namespaceURI, final String qualifiedName, final String value,
46 final boolean specified) {
47 super(namespaceURI, qualifiedName, page);
48
49 if (value != null && value.isEmpty()) {
50 value_ = DomElement.ATTRIBUTE_VALUE_EMPTY;
51 }
52 else {
53 value_ = value;
54 }
55
56 specified_ = specified;
57 }
58
59 /**
60 * {@inheritDoc}
61 */
62 @Override
63 public short getNodeType() {
64 return ATTRIBUTE_NODE;
65 }
66
67 /**
68 * {@inheritDoc}
69 */
70 @Override
71 public String getNodeName() {
72 return getName();
73 }
74
75 /**
76 * {@inheritDoc}
77 */
78 @Override
79 public String getNodeValue() {
80 return getValue();
81 }
82
83 /**
84 * {@inheritDoc}
85 */
86 @Override
87 public String getName() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…