Changeset 29063 for main/trunk


Ignore:
Timestamp:
2014-05-19T13:19:11+12:00 (10 years ago)
Author:
kjdon
Message:

getMetadataPrefixElement code was all oai_dc specific. New string META_FORMAT_DC for 'oai_dc'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/OAIXML.java

    r29057 r29063  
    100100  public static final String SCHEMA = "schema";
    101101  public static final String METADATA_NAMESPACE = "metadataNamespace";
    102   public static final String OAI_DC = "oai_dc";
    103   public static final String DC = "dc";
     102  public static final String META_FORMAT_DC = "oai_dc";
    104103
    105104  // record response data
     
    509508    return oai;
    510509  }
     510
    511511  public static Element getMetadataPrefixElement(Document doc, String prefix, String version) {
    512     //examples of tag_name: dc, oai_dc:dc, etc.
    513     String tag_name = getMetadataTagName(prefix, version);
    514     Element oai = doc.createElement(tag_name);
    515     if (version.equals(OAI_VERSION2)) {
    516       oai.setAttribute("xmlns:oai_dc", "http://www.openarchives.org/OAI/2.0/oai_dc/");
    517       oai.setAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/");
    518       oai.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
    519       oai.setAttribute("xsi:schemaLocation", "http://www.openarchives.org/OAI/2.0/oai_dc/ \n http://www.openarchives.org/OAI/2.0/oai_dc.xsd");
    520     } else {
    521       oai.setAttribute("xmlns", "http://www.openarchives.com/OAI/1.1/");
    522       oai.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
    523       oai.setAttribute("xsi:schemaLocation", "http://www.openarchives.org/OAI/1.1/" + tag_name + ".xsd");       
    524     }
    525      
    526     return oai;
    527   }
     512    if (prefix.equals(META_FORMAT_DC)) {
     513      //examples of tag_name: dc, oai_dc:dc, etc.
     514      String tag_name = getMetadataTagName(prefix, version);
     515      Element oai = doc.createElement(tag_name);
     516      if (version.equals(OAI_VERSION2)) {
     517    oai.setAttribute("xmlns:oai_dc", "http://www.openarchives.org/OAI/2.0/oai_dc/");
     518    oai.setAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/");
     519    oai.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
     520    oai.setAttribute("xsi:schemaLocation", "http://www.openarchives.org/OAI/2.0/oai_dc/ \n http://www.openarchives.org/OAI/2.0/oai_dc.xsd");
     521      } else {
     522    oai.setAttribute("xmlns", "http://www.openarchives.com/OAI/1.1/");
     523    oai.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
     524    oai.setAttribute("xsi:schemaLocation", "http://www.openarchives.org/OAI/1.1/" + tag_name + ".xsd");       
     525      }
     526      return oai;
     527    }
     528    return null;
     529   
     530  }
     531
    528532  public static String getMetadataTagName(String prefix, String oai_version) {
    529     if (prefix.equals("oai_dc")) {
     533    if (prefix.equals(META_FORMAT_DC)) {
    530534      if (oai_version.equals(OAI_VERSION2)) {
    531535    return "oai_dc:dc";
Note: See TracChangeset for help on using the changeset viewer.