Last change
on this file since 31911 was 28966, checked in by kjdon, 10 years ago |
Lots of changes. Mainly to do with removing this.doc from everywhere. Document is not thread safe. Now we tend to create a new Document everytime we are starting a new page/message etc. in service this.desc_doc is available as teh document to create service info stuff. But it should only be used for this and not for other messages. newDOM is now static for XMLConverter. method param changes for some GSXML methods.
|
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1.0 KB
|
Line | |
---|
1 | package org.greenstone.gsdl3.service;
|
---|
2 |
|
---|
3 | import org.greenstone.gsdl3.util.*;
|
---|
4 | import org.w3c.dom.Document;
|
---|
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(Document result_doc, Element section) {
|
---|
14 | Element meta_elem = result_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(result_doc.importNode(t, false));
|
---|
37 | return meta_elem;
|
---|
38 |
|
---|
39 | }
|
---|
40 |
|
---|
41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.