source: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/TEIRetrieve.java@ 25128

Last change on this file since 25128 was 5262, checked in by kjdon, 21 years ago

fixed an oversight

  • Property svn:keywords set to Author Date Id Revision
File size: 1.5 KB
Line 
1package org.greenstone.gsdl3.service;
2
3
4// Greenstone classes
5import org.greenstone.gsdl3.util.*;
6
7// XML classes
8import org.w3c.dom.Element;
9import org.w3c.dom.Node;
10import org.w3c.dom.Text;
11
12// General Java classes
13
14// just needs to override a few methods that are TEI specific
15public class TEIRetrieve extends XMLRetrieve {
16
17 protected Element extractTitleMeta(Element section) {
18
19 Element meta_elem = this.doc.createElement(GSXML.METADATA_ELEM);
20 meta_elem.setAttribute(GSXML.NAME_ATT, "Title");
21
22 Element section_head = (Element)GSXML.getChildByTagName(section, "head");
23 if (section_head == null || !section_head.hasChildNodes()) {
24 // there is no head element, so take the type attribute and make that the title
25 String title = "("+section.getAttribute("type")+")";
26 Text t = this.doc.createTextNode(title);
27 meta_elem.appendChild(t);
28 } else {
29 // add the head element as the metadata content
30 meta_elem.appendChild(this.doc.importNode(section_head, true));
31 }
32 return meta_elem;
33 }
34
35 // this assumes that the scope refers to a top level node - this may be overwritten if the scope bit in the id is a shorthand of some sort
36 protected String translateScope(String scope) {
37 if (scope.equals("front")) {
38 return "text/front";
39 }
40 if (scope.equals("body")) {
41 return "text/body";
42 }
43 if (scope.equals("back")) {
44 return "text/back";
45 }
46 if (scope.equals("full")) { // is this ever used???
47 return "";
48 }
49 return scope;
50 }
51
52}
Note: See TracBrowser for help on using the repository browser.