Package: dom4j / 2.1.3-1

07_xpp2-compatibility.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Description: Fixes the compatibility with the version of xpp2 in Debian
Origin: backport, https://github.com/dom4j/dom4j/pull/22/files
--- a/src/main/java/org/dom4j/xpp/ProxyXmlStartTag.java
+++ b/src/main/java/org/dom4j/xpp/ProxyXmlStartTag.java
@@ -211,7 +211,7 @@
      * @throws XmlPullParserException
      *             DOCUMENT ME!
      */
-    public void removeAtttributes() throws XmlPullParserException {
+    public void removeAttributes() throws XmlPullParserException {
         if (element != null) {
             element.setAttributes(new ArrayList());
 
@@ -221,6 +221,33 @@
         }
     }
 
+    public boolean removeAttributeByName(String namespaceURI, String localName) throws XmlPullParserException {
+        if (element != null) {
+            for (Iterator<Attribute> iter = element.attributeIterator(); iter.hasNext();) {
+                Attribute attribute = iter.next();
+
+                if (namespaceURI.equals(attribute.getNamespaceURI())
+                        && localName.equals(attribute.getName())) {
+                    return element.remove(attribute);
+                }
+            }
+        }
+        return false;
+    }
+
+    public boolean removeAttributeByRawName(String rawName) throws XmlPullParserException {
+        if (element != null) {
+            for (Iterator<Attribute> iter = element.attributeIterator(); iter.hasNext();) {
+                Attribute attribute = iter.next();
+
+                if (rawName.equals(attribute.getQualifiedName())) {
+                    return element.remove(attribute);
+                }
+            }
+        }
+        return false;
+    }
+
     public String getLocalName() {
         return element.getName();
     }