Changeset 3985 for trunk/gsdl3/src/java/org/greenstone/gsdl3
- Timestamp:
- 2003-03-25T16:11:19+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GSXML.java
r3969 r3985 1 1 package org.greenstone.gsdl3.util; 2 2 3 import org.w3c.dom.NamedNodeMap; 3 4 import org.w3c.dom.Node; 4 5 import org.w3c.dom.Element; … … 316 317 317 318 319 /** Duplicates an element, but gives it a new name */ 320 public static Element duplicateWithNewName(Document owner, Element element, 321 String element_name, boolean with_attributes) 322 { 323 Element duplicate = owner.createElement(element_name); 324 325 // Copy element attributes 326 if (with_attributes) { 327 NamedNodeMap attributes = element.getAttributes(); 328 for (int i = 0; i < attributes.getLength(); i++) { 329 Node attribute = attributes.item(i); 330 duplicate.setAttribute(attribute.getNodeName(), attribute.getNodeValue()); 331 } 332 } 333 334 // Copy element children 335 NodeList children = element.getChildNodes(); 336 for (int i = 0; i < children.getLength(); i++) { 337 Node child = children.item(i); 338 duplicate.appendChild(owner.importNode(child, true)); 339 } 340 341 return duplicate; 342 } 343 344 318 345 /** returns a basic request message */ 319 346 public static Element createBasicRequest(Document owner,
Note:
See TracChangeset
for help on using the changeset viewer.