2828public class Attributes {
2929 private final Map <String , Map <String , TextContent >> attributes = new HashMap <>();
3030
31- public boolean isEmpty () {
32- return attributes .isEmpty ();
33- }
34-
3531 public void add (String namespaceURI , String localName , TextContent value ) {
3632 attributes .computeIfAbsent (namespaceURI , v -> new HashMap <>()).put (localName , value );
3733 }
@@ -60,6 +56,18 @@ public void addAll(String namespaceURI, Map<String, TextContent> attributes) {
6056 this .attributes .computeIfAbsent (namespaceURI , v -> new HashMap <>()).putAll (attributes );
6157 }
6258
59+ public boolean contains (String localName ) {
60+ return contains (XMLConstants .NULL_NS_URI , localName );
61+ }
62+
63+ public boolean contains (QName name ) {
64+ return contains (name .getNamespaceURI (), name .getLocalPart ());
65+ }
66+
67+ public boolean contains (String namespaceURI , String localName ) {
68+ return get (namespaceURI ).containsKey (localName );
69+ }
70+
6371 public Map <String , Map <String , TextContent >> get () {
6472 return attributes ;
6573 }
@@ -80,6 +88,10 @@ public TextContent getValue(QName name) {
8088 return getValue (name .getNamespaceURI (), name .getLocalPart ());
8189 }
8290
91+ public boolean isEmpty () {
92+ return attributes .isEmpty ();
93+ }
94+
8395 public Attributes copy () {
8496 Attributes copy = new Attributes ();
8597 copy .attributes .putAll (attributes );
0 commit comments