- Timestamp:
- 2014-05-19T13:19:11+12:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/OAIXML.java
r29057 r29063 100 100 public static final String SCHEMA = "schema"; 101 101 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"; 104 103 105 104 // record response data … … 509 508 return oai; 510 509 } 510 511 511 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 528 532 public static String getMetadataTagName(String prefix, String oai_version) { 529 if (prefix.equals( "oai_dc")) {533 if (prefix.equals(META_FORMAT_DC)) { 530 534 if (oai_version.equals(OAI_VERSION2)) { 531 535 return "oai_dc:dc";
Note:
See TracChangeset
for help on using the changeset viewer.