Ignore:
Timestamp:
2011-01-25T14:48:39+13:00 (13 years ago)
Author:
sjm84
Message:

Adding the latest trunk changes as well as tidying up several files and removing more -m32 stuff

Location:
main/branches/64_bit_Greenstone/greenstone3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/branches/64_bit_Greenstone/greenstone3

  • main/branches/64_bit_Greenstone/greenstone3/src/java/org/greenstone/gsdl3/util/GSXML.java

    r23489 r23632  
    414414  }
    415415 
    416   /** copies the metadata out of teh metadataList of 'from' into
     416  /** copies the metadata out of the metadataList of 'from' into
    417417   * the metadataList of 'to' */
    418418  public static boolean mergeMetadataLists(Node to, Node from) {
    419     Node to_meta = getChildByTagName(to, METADATA_ELEM+LIST_MODIFIER);
    420419    Node from_meta = getChildByTagName(from, METADATA_ELEM+LIST_MODIFIER);
    421    
    422420    if  (from_meta == null) { // nothing to copy
    423421      return true;
    424422    }
     423    return mergeMetadataFromList(to, from_meta);
     424  }
     425 
     426
     427  /** copies the metadata out of the meta_list metadataList  into
     428   * the metadataList of 'to' */
     429  public static boolean mergeMetadataFromList(Node to, Node meta_list) {
     430    if (meta_list == null) return false;
     431    Node to_meta = getChildByTagName(to, METADATA_ELEM+LIST_MODIFIER);
    425432    Document to_owner = to.getOwnerDocument();
    426     Node new_from = to_owner.importNode(from_meta, true);
    427    
    428     if (to_meta == null) { // just copy the whole list
    429       to.appendChild(new_from);
     433    if (to_meta == null) {
     434      to.appendChild(to_owner.importNode(meta_list, true));
    430435      return true;
    431436    }
    432    
    433     // copy individual elements
    434     Node child = new_from.getFirstChild();
    435     while ( child != null) {
    436       to_meta.appendChild(child);
    437       child = child.getNextSibling();
     437    // copy individual metadata elements
     438    NodeList meta_items = ((Element)meta_list).getElementsByTagName(METADATA_ELEM);
     439    for (int i=0; i<meta_items.getLength(); i++) {
     440      to_meta.appendChild(to_owner.importNode(meta_items.item(i),true));
    438441    }
    439442    return true;
Note: See TracChangeset for help on using the changeset viewer.