Mercurial > hg > mpdl-group
diff software/eXist/mpdl-modules/src/de/mpg/mpiwg/berlin/mpdl/externalObjects/app/ExtElement.java @ 9:1ec29fdd0db8
neue .lex Dateien f?r Normalisierung / externe Objekte update
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 22 Feb 2011 16:03:45 +0100 |
parents | 2396a569e446 |
children | fba5577e49d9 |
line wrap: on
line diff
--- a/software/eXist/mpdl-modules/src/de/mpg/mpiwg/berlin/mpdl/externalObjects/app/ExtElement.java Thu Feb 10 14:02:05 2011 +0100 +++ b/software/eXist/mpdl-modules/src/de/mpg/mpiwg/berlin/mpdl/externalObjects/app/ExtElement.java Tue Feb 22 16:03:45 2011 +0100 @@ -8,12 +8,17 @@ public class ExtElement extends ExtObject { private String pageNumber; private String xmlNodeId; - private String before; + private String before = "false"; private String charPos; private String xpath; + public ExtElement() { + this.type = "element"; + } + public static ExtElement parseXmlStr(String xmlStr) throws ApplicationException { XmlUtil xmlUtil = XmlUtil.getInstance(); + xmlUtil.setNsContext("general"); String uid = xmlUtil.evaluateToString(xmlStr, "/object/@uid", null); String dateStr = xmlUtil.evaluateToString(xmlStr, "/object/@modificationDate", null); String docId = xmlUtil.evaluateToString(xmlStr, "/object/@documentId", null); @@ -24,8 +29,6 @@ String xpath = xmlUtil.evaluateToString(xmlStr, "/object/@xpath", null); String content = xmlUtil.evaluateToXmlString(xmlStr, "/object/content/*", null); Date modDate = xmlUtil.toDate(dateStr); - if (uid == null || docId == null || pageNumber == null) - throw new ApplicationException("one of the required fields could not be read in: " + xmlStr); ExtElement e = new ExtElement(); e.setUid(uid); e.setModificationDate(modDate); @@ -44,7 +47,13 @@ } public String getXmlString() { - String xmlString = "<object"; + String xmlString = "<object xmlns:xlink=\"http://www.w3.org/1999/xlink\""; + xmlString = xmlString + " type=\"" + type + "\""; + if (modificationDate != null) { + XmlUtil xmlUtil = XmlUtil.getInstance(); + String dateStr = xmlUtil.toXsDate(modificationDate); + xmlString = xmlString + " modificationDate=\"" + dateStr + "\""; + } if (uid != null) xmlString = xmlString + " uid=\"" + uid + "\""; if (documentId != null) @@ -59,11 +68,6 @@ xmlString = xmlString + " charPos=\"" + charPos + "\""; if (xpath != null) xmlString = xmlString + " xpath=\"" + xpath + "\""; - if (modificationDate != null) { - XmlUtil xmlUtil = XmlUtil.getInstance(); - String dateStr = xmlUtil.toXsDate(modificationDate); - xmlString = xmlString + " modificationDate=\"" + dateStr + "\""; - } xmlString = xmlString + ">"; if (content != null) { // write the uid and modificationDate into the content node @@ -110,6 +114,13 @@ this.pageNumber = pageNumber; } + public boolean isBefore() { + if (before != null && before.equals("true")) + return true; + else + return false; + } + public String getBefore() { return before; }