Changeset 21794 for main/trunk/greenstone3/src/java/org/greenstone/gsdl3
- Timestamp:
- 2010-03-15T15:43:48+13:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/OAIXML.java
r21780 r21794 89 89 public static final String CURSOR = "cursor"; 90 90 public static final String DATESTAMP = "datestamp"; 91 public static final String DC_METADATA_NAMES = "DCMetadataNames";92 91 public static final String DELETED_RECORD = "deletedRecord"; 93 92 public static final String DESCRIPTION = "description"; … … 317 316 return oai_config_elem; 318 317 } 318 319 public static String[] getMetadataMapping(Element metadata_format) { 320 321 if (metadata_format == null) { 322 return null; 323 } 324 NodeList mappings = metadata_format.getElementsByTagName(MAPPING); 325 int size = mappings.getLength(); 326 if (size == 0) { 327 logger.info("No metadata mappings are provided in OAIConfig.xml."); 328 return null; 329 } 330 String[] names = new String[size]; 331 for (int i=0; i<size; i++) { 332 names[i] = GSXML.getNodeText((Element)mappings.item(i)).trim(); 333 } 334 return names; 335 336 } 337 319 338 public static String[] getGlobalMetadataMapping(String prefix) { 320 339 Element list_meta_formats = (Element)GSXML.getChildByTagName(oai_config_elem, LIST_METADATA_FORMATS); … … 326 345 return null; 327 346 } 328 NodeList mappings = metadata_format.getElementsByTagName(MAPPING); 329 int size = mappings.getLength(); 330 if (size == 0) { 331 logger.info("No metadata mappings are provided in OAIConfig.xml."); 332 return null; 333 } 334 String[] names = new String[size]; 335 for (int i=0; i<size; i++) { 336 names[i] = GSXML.getNodeText((Element)mappings.item(i)).trim(); 337 } 338 return names; 339 } 340 public static String[] getDublinCoreNames() { 341 // read the standard Dublin Core metadata names 342 //<DCmetadataNames>dc.Title,dc.Creator,dc.Subject,dc.Description,dc.Publisher,dc.Contributor,dc.Date,dc.Type,dc.Format,dc.Identifier,dc.Source,dc.Language,dc.Relation,dc.Coverage,dc.Rights</DCmetadataNames> 343 Element dc_metadata_names = (Element)GSXML.getChildByTagName(oai_config_elem, DC_METADATA_NAMES); 344 if(dc_metadata_names == null) { 345 logger.error("Dublin Core metadata names are not provided."); 346 return null; 347 } 348 String names = GSXML.getNodeText(dc_metadata_names).trim(); 349 return names.split(","); 350 // String[] str = {"dc.Title","dc.Creator","dc.Subject","dc.Description","dc.Publisher","dc.Contributor","dc.Date","dc.Type","dc.Format","dc.Identifier","dc.Source","dc.Language","dc.Relation","dc.Coverage","dc.Rights"}; 351 // return str; 352 } 347 return getMetadataMapping(metadata_format); 348 } 349 353 350 354 351 public static long getTokenExpiration() { … … 517 514 Element oai = response_doc.createElement(tag_name); 518 515 if (version.equals(OAI_VERSION2)) { 519 oai.setAttribute("xmlns", "http://www.openarchives.org/OAI/2.0/"); 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/"); 520 518 oai.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); 521 oai.setAttribute("xsi:schemaLocation", "http://www.openarchives.org/OAI/2.0 \n http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd");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"); 522 520 } else { 523 521 oai.setAttribute("xmlns", "ttp://www.openarchives.com/OAI/1.1/");
Note:
See TracChangeset
for help on using the changeset viewer.