Changeset 9504


Ignore:
Timestamp:
2005-03-30T14:16:43+12:00 (19 years ago)
Author:
kjdon
Message:

added duplicateWithNewNameNS that gives the new element a different namespace

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/util/GSXML.java

    r9261 r9504  
    407407                           String element_name, boolean with_attributes)
    408408    {
    409     Element duplicate = owner.createElement(element_name);
    410 
     409    return duplicateWithNewNameNS(owner, element, element_name, null, with_attributes);
     410    }
     411
     412    /** Duplicates an element, but gives it a new name */
     413    public static Element duplicateWithNewNameNS(Document owner,
     414                         Element element,
     415                         String element_name,
     416                         String namespace_uri,
     417                         boolean with_attributes)
     418    {
     419    Element duplicate;
     420    if (namespace_uri == null) {
     421        duplicate = owner.createElement(element_name);
     422    } else {
     423        duplicate = owner.createElementNS(namespace_uri, element_name);
     424    }
    411425    // Copy element attributes
    412426    if (with_attributes) {
Note: See TracChangeset for help on using the changeset viewer.