Last change
on this file since 26198 was 5966, checked in by kjdon, 20 years ago |
subclass of XMLRetrieve for Gutenberg project books
|
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1006 bytes
|
Line | |
---|
1 | package org.greenstone.gsdl3.service;
|
---|
2 |
|
---|
3 | import org.greenstone.gsdl3.util.*;
|
---|
4 |
|
---|
5 | import org.w3c.dom.Element;
|
---|
6 | import org.w3c.dom.Node;
|
---|
7 | import org.w3c.dom.Text;
|
---|
8 | import org.w3c.dom.NodeList;
|
---|
9 |
|
---|
10 | public class GutBookRetrieve
|
---|
11 | extends XMLRetrieve {
|
---|
12 |
|
---|
13 | protected Element extractTitleMeta(Element section) {
|
---|
14 | Element meta_elem = this.doc.createElement(GSXML.METADATA_ELEM);
|
---|
15 | meta_elem.setAttribute(GSXML.NAME_ATT, "Title");
|
---|
16 |
|
---|
17 | Element title_elem = (Element)GSXML.getChildByTagName(section, "title");
|
---|
18 | if (title_elem == null) {
|
---|
19 | title_elem = (Element)GSXML.getNodeByPath(section, "chapheader/title");
|
---|
20 | }
|
---|
21 | if (title_elem == null) {
|
---|
22 | // find teh first title elem
|
---|
23 | NodeList titles = section.getElementsByTagName("title");
|
---|
24 | if (titles != null) {
|
---|
25 | title_elem = (Element)titles.item(0);
|
---|
26 | }
|
---|
27 | }
|
---|
28 |
|
---|
29 | if (title_elem == null) {
|
---|
30 | return null; // no title found
|
---|
31 | }
|
---|
32 |
|
---|
33 |
|
---|
34 | Text t = (Text) GSXML.getNodeTextNode(title_elem);
|
---|
35 |
|
---|
36 | meta_elem.appendChild(this.doc.importNode(t, false));
|
---|
37 | return meta_elem;
|
---|
38 |
|
---|
39 | }
|
---|
40 |
|
---|
41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.