");
-
- for (i = 0; i < count; i++) {
- Row item = vtable.get(i);
- article.setData(item);
-
- line = article.getContent();
-
- if(line!=null) {
- if (i == 0 && line.trim().length()>0 && line.charAt(0)!='<')
- line = "
" + line.substring(0, 1)
- + "" + line.substring(1, line.length());
+
+ int count = vtable.size();
+ StringBuffer content = new StringBuffer();
+ String line;
+
+ if (count > 0) {
+ int i;
+
+ content.append("
");
+
+ for (i = 0; i < count; i++) {
+ Row item = vtable.get(i);
+ article.setData(item);
+
+ line = article.getContent();
+
+ if(line!=null) {
+ if (i == 0 && line.trim().length()>0 && line.charAt(0)!='<')
+ line = "
" + line.substring(0, 1)
+ + "" + line.substring(1, line.length());
if(line.contains("div")){
System.err.println(article.getId());
- }
- line = line.replaceAll("
", "
").replaceAll("\n\n", "
");
- content
- .append("
" + line + "");
- }
-
- }
-
- content.append("
");
- } else {
- content.append("暂时没有任何内容");
- }
-
- this.setVariable("content", content.toString());
-
- return this;
- }
-
- public String feed() throws ApplicationException {
+ }
+ line = line.replaceAll("
", "
").replaceAll("\n\n", "
");
+ content
+ .append("
" + line + "");
+ }
+
+ }
+
+ content.append("
");
+ } else {
+ content.append("暂时没有任何内容");
+ }
+
+ this.setVariable("content", content.toString());
+
+ return this;
+ }
+
+ public String feed() throws ApplicationException {
throw new ApplicationException("Invalid book Id");
- }
-
- public String feed(String bookId, int chapterId) throws ApplicationException {
- Element element = new Element();
-
- Element root = (Element) element.clone();
- root.setName("rss");
- root.setAttribute("version", "2.0");
- root.setAttribute("xmlns:content",
- "http://purl.org/rss/1.0/modules/content/");
- root.setAttribute("xmlns:wfw", "http://wellformedweb.org/CommentAPI/");
- root.setAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/");
- root.setAttribute("xmlns:atom", "http://www.w3.org/2005/Atom");
- root.setAttribute("xmlns:sy",
- "http://purl.org/rss/1.0/modules/syndication/");
- root.setAttribute("xmlns:slash",
- "http://purl.org/rss/1.0/modules/slash/");
-
- Element channel = (Element) element.clone();
- channel.setName("channel");
-
- Element title = (Element) element.clone();
- title.setName("title");
- title.setData(this.getProperty("application.title"));
- channel.addElement(title);
-
- Element atom_link = (Element) element.clone();
- atom_link.setName("atom:link");
- atom_link.setAttribute("href", this.getLink("bible").replaceAll("&", "&"));
- atom_link.setAttribute("rel", "self");
- atom_link.setAttribute("type", "application/rss+xml");
- channel.addElement(atom_link);
-
- Element link = (Element) element.clone();
- link.setName("link");
- link.setData(this.getLink("bible").replaceAll("&", "&"));
- channel.addElement(link);
-
- Element description = (Element) element.clone();
- description.setName("description");
- description.setData("");
- channel.addElement(description);
-
- Date date = new Date();
- SimpleDateFormat format = new SimpleDateFormat("MM/dd"),full_format = new SimpleDateFormat("yyyy-MM-dd");
- Element lastBuildDate = (Element) element.clone();
- lastBuildDate.setName("lastBuildDate");
-
- lastBuildDate.setData(full_format.format(date));
- channel.addElement(lastBuildDate);
-
- Element generator = (Element) element.clone();
- generator.setName("generator");
- generator.setData("g");
- channel.addElement(generator);
-
- Element language = (Element) element.clone();
- language.setName("language");
- language.setData(this.getLocale().toString());
- channel.addElement(language);
-
- Element sy_updatePeriod = (Element) element.clone();
- sy_updatePeriod.setName("sy:updatePeriod");
- sy_updatePeriod.setData("daily");
- channel.addElement(sy_updatePeriod);
-
- Element sy_updateFrequency = (Element) element.clone();
- sy_updateFrequency.setName("sy:updateFrequency");
- sy_updateFrequency.setData("1");
- channel.addElement(sy_updateFrequency);
-
- Table vtable = this.load(bookId, chapterId, 0);
-
- Element item = new Element("item");
- Element item_title = new Element("title");
- item_title.setData("");
- item.addElement(item_title);
-
- Element item_link = new Element("link");
- item_link.setData(this.getLink("bible").replace("&", "&")+"/"+ format.format(new Date()));
- item.addElement(item_link);
-
- Element item_comments = new Element("comments");
- item_comments.setData("");
- item.addElement(item_comments);
-
- Element item_pubDate = new Element("pubDate");
- item_pubDate.setData(full_format.format(date));
- item.addElement(item_pubDate);
-
- Element dc_creator = new Element("dc:creator");
- dc_creator.setData("");
- item.addElement(dc_creator);
-
- Element category = (Element) element.clone();
- category.setName("category");
- category.setData(format.format(date));
- item.addElement(category);
-
- Element guid = (Element) element.clone();
- guid.setName("guid");
- guid.setAttribute("isPermaLink", "true");
- guid.setData(this.getLink("feed").replace("&", "&")+"/"
- + format.format(new Date()));
- item.addElement(guid);
-
- // start
- StringBuffer buffer=new StringBuffer();
- String finded;
- buffer.append("