Mercurial > hg > mpdl-group
comparison software/eXist/mpdl-modules/src/de/mpg/mpiwg/berlin/mpdl/externalObjects/app/ExtElement.java @ 14:5df60f24e997
diverse Fehlerbehebungen
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Mon, 29 Aug 2011 17:40:02 +0200 |
parents | fba5577e49d9 |
children |
comparison
equal
deleted
inserted
replaced
13:469d927b9ca7 | 14:5df60f24e997 |
---|---|
23 String xpointer = xmlUtil.evaluateToString(xmlStr, "/object/@xpointer", null); | 23 String xpointer = xmlUtil.evaluateToString(xmlStr, "/object/@xpointer", null); |
24 String pageNumber = null; | 24 String pageNumber = null; |
25 String xpath = null; | 25 String xpath = null; |
26 String point = null; | 26 String point = null; |
27 if (xpointer != null) { | 27 if (xpointer != null) { |
28 pageNumber = xpointer.replaceAll("#xpointer\\(id\\('page(.+)?'\\).*", "$1"); | 28 pageNumber = xpointer.replaceAll("id\\('page(.+)?'\\).*", "$1"); |
29 if (xpointer.contains("point(")) { | 29 if (xpointer.contains("point(")) { |
30 xpath = xpointer.replaceAll("#xpointer\\(id\\('page.+?'\\)(.*)?/point\\(.+?\\)\\)", "$1"); | 30 xpath = xpointer.replaceAll("id\\('page.+?'\\)(.*)?/point\\(.+?\\)", "$1"); |
31 point = xpointer.replaceAll("#xpointer\\(id\\('page.+?'\\).*?/point\\((.+)?\\)\\)", "$1"); | 31 point = xpointer.replaceAll("id\\('page.+?'\\).*?/point\\((.+)?\\)", "$1"); |
32 } else { | 32 } else { |
33 xpath = xpointer.replaceAll("#xpointer\\(id\\('page.+?'\\)(.*)?.*?\\)", "$1"); | 33 xpath = xpointer.replaceAll("id\\('page.+?'\\)(.*)?.*?", "$1"); |
34 } | 34 } |
35 } | 35 } |
36 String content = xmlUtil.evaluateToXmlString(xmlStr, "/object/content/*", null); | 36 String content = xmlUtil.evaluateToXmlString(xmlStr, "/object/*", null); |
37 Date modDate = xmlUtil.toDate(dateStr); | 37 Date modDate = xmlUtil.toDate(dateStr); |
38 ExtElement e = new ExtElement(); | 38 ExtElement e = new ExtElement(); |
39 e.setContent(content); | |
39 e.setUid(uid); | 40 e.setUid(uid); |
40 e.setModificationDate(modDate); | 41 e.setModificationDate(modDate); |
41 e.setDocumentId(docId); | 42 e.setDocumentId(docId); |
42 e.setPageNumber(pageNumber); | 43 e.setPageNumber(pageNumber); |
43 e.setXpath(xpath); | 44 e.setXpath(xpath); |
44 e.setPoint(point); | 45 e.setPoint(point); |
45 e.setContent(content); | |
46 return e; | 46 return e; |
47 } | 47 } |
48 | 48 |
49 public String toString() { | 49 public String toString() { |
50 return getXmlString(); | 50 return getXmlString(); |
63 if (documentId != null) | 63 if (documentId != null) |
64 xmlString = xmlString + " documentId=\"" + documentId + "\""; | 64 xmlString = xmlString + " documentId=\"" + documentId + "\""; |
65 if (xpath != null) | 65 if (xpath != null) |
66 xmlString = xmlString + " xmlNodeId=\"" + xpath + "\""; | 66 xmlString = xmlString + " xmlNodeId=\"" + xpath + "\""; |
67 if (pageNumber != null) | 67 if (pageNumber != null) |
68 xmlString = xmlString + " xpointer=\"#xpointer(id('page" + pageNumber + "')"; | 68 xmlString = xmlString + " xpointer=\"id('page" + pageNumber + "')"; |
69 if (xpath != null) | 69 if (xpath != null) |
70 xmlString = xmlString + xpath; | 70 xmlString = xmlString + xpath; |
71 if (point != null) | 71 if (point != null) |
72 xmlString = xmlString + "/point(" + point + ")"; | 72 xmlString = xmlString + "/point(" + point + ")"; |
73 xmlString = xmlString + ")\">"; | 73 xmlString = xmlString + "\">"; |
74 if (content != null) { | 74 if (content != null) { |
75 // TODO wieder ausbauen | 75 xmlString = xmlString + content; |
76 // write the uid and modificationDate into the content node | |
77 if (! content.contains("uid")) { | |
78 int firstClose = content.indexOf(">"); | |
79 if (firstClose != -1) | |
80 content = content.substring(0, firstClose) + " uid=\"" + uid + "\" modificationDate=\"" + modificationDate + "\" " + content.substring(firstClose); | |
81 } | |
82 xmlString = xmlString + "<content>" + content + "</content>"; | |
83 } | 76 } |
84 xmlString = xmlString + "</object>"; | 77 xmlString = xmlString + "</object>"; |
85 return xmlString; | 78 return xmlString; |
86 } | 79 } |
87 | 80 |