- Timestamp:
- 2003-06-03T17:19:41+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/msm/ElementWrapper.java
r4365 r4467 187 187 } 188 188 189 public void removeAttribute(String name, String value) { 190 Element attributes[] = MSMUtils.getAttributeNodesNamed(element, name); 191 // For each of the attribute nodes which match the requested name... 192 for(int i = 0; attributes != null && i < attributes.length; i++) { 193 // Retrieve the value for this node... 194 String current = MSMUtils.getValue(attributes[i]); 195 // And if it matches our removal value, remove the attribute node. 196 if(current.equals(value)) { 197 element.removeChild(attributes[i]); 198 current = null; 199 attributes = null; 200 return; 189 190 /** Removes an Attribute node from the element. */ 191 public boolean removeAttribute(String name, String language, String value) 192 { 193 // Find the attribute to remove 194 for (Node n = element.getFirstChild(); n != null; n = n.getNextSibling()) { 195 if (n.getNodeName().equals("Attribute")) { 196 Element e = (Element) n; 197 if (e.getAttribute("name").equals(name) && 198 e.getAttribute("language").equalsIgnoreCase(language) && 199 MSMUtils.getValue(e).equals(value)) { 200 // Match found, so remove the attribute node and return 201 element.removeChild(n); 202 return true; 203 } 201 204 } 202 current = null; 203 } 204 // If we get this far then theres no match. Boo-hoo. 205 attributes = null; 206 } 205 } 206 207 // No match found 208 return false; 209 } 210 211 207 212 /** Set the value of the namespace required flag. 208 213 * @param namespace_required The new value as a <i>boolean</i>.
Note:
See TracChangeset
for help on using the changeset viewer.