package org.argeo.docbook.ui;
+import static org.argeo.docbook.DbkUtils.isDbk;
+import static org.argeo.docbook.DbkType.para;
+import static org.argeo.docbook.DbkType.title;
+
import java.io.IOException;
import java.io.StringReader;
import java.util.List;
try {
if (item instanceof Node) {
Node node = (Node) item;
- if (node.isNodeType(DocBookTypes.PARA) || node.isNodeType(DocBookTypes.TITLE)) {
+ if (isDbk(node, para) || isDbk(node, title)) {
String raw = convertToStorage(node, content);
validateBeforeStoring(raw);
Node jcrText;
item.getSession().refresh(true);
if (item instanceof Node) {
Node node = (Node) item;
- if (node.isNodeType(DocBookTypes.PARA) || node.isNodeType(DocBookTypes.TITLE)) {
+ if (isDbk(node, para) || isDbk(node, title)) {
Node jcrText = node.getNode(Jcr.JCR_XMLTEXT);
String txt = jcrText.getProperty(Jcr.JCR_XMLCHARACTERS).getString();
// TODO make it more robust
public String readSimpleHtml(Item item) {
String raw = raw(item);
+ // FIXME the saved data should be corrected instead.
+ if (raw.indexOf('&') >= 0) {
+ raw = raw.replace("&", "&");
+ }
+ if (raw.indexOf('<') >= 0) {
+ raw = raw.replace("<", "<");
+ }
+ if (raw.indexOf('>') >= 0) {
+ raw = raw.replace(">", ">");
+ }
+ if (raw.indexOf('\"') >= 0) {
+ raw = raw.replace("\"", """);
+ }
+ if (raw.indexOf('\'') >= 0) {
+ raw = raw.replace("\'", "'");
+ }
// raw = "<span style='text-align:justify'>" + raw + "</span>";
if (raw.length() == 0)
return raw;