List of usage examples for org.dom4j Element addText
Element addText(String text);
Text
node with the given text to this element. From source file:cz.fi.muni.xkremser.editor.server.newObject.MonographBuilder.java
License:Open Source License
private void addTopic(Document modsDoc, MarcSpecificMetadata marc) { String topic = marc.getTopic(); if (topic != null) { Element modsEl = (Element) modsXpath.selectSingleNode(modsDoc); Element subjectEl = modsEl.addElement(new QName("subject", Namespaces.mods)); Element topicEl = subjectEl.addElement(new QName("topic", Namespaces.mods)); topicEl.addText(topic); }/* www.java2 s.c o m*/ }
From source file:cz.fi.muni.xkremser.editor.server.newObject.MonographBuilder.java
License:Open Source License
private void addSysno(Document modsDoc, MarcSpecificMetadata marc) { String sysno = marc.getSysno(); if (sysno != null) { Element modsEl = (Element) modsXpath.selectSingleNode(modsDoc); Element identifierEl = modsEl.addElement(new QName("identifier", Namespaces.mods)); identifierEl.addAttribute("type", "sysno"); identifierEl.addText(sysno); }/*from ww w. ja va 2 s .co m*/ }
From source file:cz.fi.muni.xkremser.editor.server.newObject.MonographBuilder.java
License:Open Source License
private void addLinks(Document modsDoc, MarcSpecificMetadata marc, String uuid) { Element copyInformation = (Element) copyInformationXpath.selectSingleNode(modsDoc); copyInformation.addElement(new QName("electronicLocator", Namespaces.mods)); copyInformation.addText(alephLink(marc)); Element location = (Element) locationXpath.selectSingleNode(modsDoc); Element url = location.addElement(new QName("url", Namespaces.mods)); url.addText(krameriusLink(uuid));//from w w w .ja va2s .co m }
From source file:cz.fi.muni.xkremser.editor.server.newObject.MonographBuilder.java
License:Open Source License
private void addPublishmentPlace(Element originInfoEl, MarcSpecificMetadata marc) { String place = marc.getPlace(); if (place != null) { Element placeEl = originInfoEl.addElement(new QName("place", Namespaces.mods)); Element placeTerm = placeEl.addElement(new QName("placeTerm", Namespaces.mods)); placeTerm.addAttribute("type", "text"); placeTerm.addText(place); }//ww w .j a v a2s . c o m }
From source file:cz.fi.muni.xkremser.editor.server.newObject.MonographBuilder.java
License:Open Source License
private void addPublisher(Element originInfoEl, MarcSpecificMetadata marc) { String name = marc.getPublisher(); if (name != null) { Element publisher = originInfoEl.addElement(new QName("publisher", Namespaces.mods)); publisher.addText(name); }//from w ww. ja v a 2s. c o m }
From source file:cz.fi.muni.xkremser.editor.server.newObject.MonographBuilder.java
License:Open Source License
private void addPublishmentDate(Element originInfoEl, MarcSpecificMetadata marc) { String dates = marc.getDateIssued(); if (dates != null) { Element dateIssued = originInfoEl.addElement(new QName("dateIssued", Namespaces.mods)); dateIssued.addText(dates); }//w w w . j a va 2s . co m }
From source file:cz.fi.muni.xkremser.editor.server.newObject.MonographBuilder.java
License:Open Source License
private void updateRecordInfo(Document modsDoc, String uuid) { Element recordInfo = (Element) recordInfoXpath.selectSingleNode(modsDoc); if (recordInfo == null) { recordInfo = modsDoc.getRootElement().addElement(new QName("recordInfo", Namespaces.mods)); }/*from w ww . ja v a2 s .c o m*/ Date now = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); String nowStr = sdf.format(now); Element creationDate = recordInfo.addElement(new QName("recordCreationDate", Namespaces.mods)); creationDate.addAttribute("encoding", "iso8601"); creationDate.addText(nowStr); Element changeDate = recordInfo.addElement(new QName("recordChangeDate", Namespaces.mods)); changeDate.addAttribute("encoding", "iso8601"); changeDate.addText(nowStr); Element recordId = recordInfo.addElement(new QName("recordIdentifier", Namespaces.mods)); recordId.addText("uuid:" + uuid); }
From source file:cz.fi.muni.xkremser.editor.server.newObject.PageBuilder.java
License:Open Source License
/** * {@inheritDoc}/* w w w . j a v a 2 s . c o m*/ */ @Override protected void decorateMODSStream() { String pageLabel = getLabel(); Element modsCollection = FoxmlUtils.createModsCollectionEl(); Namespace modsNs = Namespaces.mods; Element mods = modsCollection.addElement(new QName("mods", modsNs)); mods.addAttribute("version", "3.3"); Element idUrn = mods.addElement(new QName("identifier", modsNs)); idUrn.addAttribute("type", "urn"); idUrn.addText(getUuid()); Element idSici = mods.addElement(new QName("identifier", modsNs)); idSici.addAttribute("type", "sici"); Element typeOfResource = mods.addElement(new QName("typeOfResource", modsNs)); typeOfResource.addText("text"); Element part = mods.addElement(new QName("part", modsNs)); String resolvedPageType = Constants.PAGE_TYPES.MAP.get(getPageType()); part.addAttribute("type", resolvedPageType == null ? "NormalPage" : resolvedPageType); //pageNumber Element detail = part.addElement(new QName("detail", modsNs)); detail.addAttribute("type", "pageNumber"); Element number = null; if (pageLabel.contains(Constants.TWO_PAGES_SEPARATOR)) { String[] splitedLabel = pageLabel.split("\\" + Constants.TWO_PAGES_SEPARATOR); number = detail.addElement(new QName("number", modsNs)); number.addText(splitedLabel[0]); number = detail.addElement(new QName("number", modsNs)); number.addText(splitedLabel[1]); } else { number = detail.addElement(new QName("number", modsNs)); number.addText(pageLabel); } //page index detail = part.addElement(new QName("detail", modsNs)); detail.addAttribute("type", "pageIndex"); number = detail.addElement(new QName("number", modsNs)); number.addText(String.valueOf(getPageIndex())); appendDatastream(DATASTREAM_CONTROLGROUP.X, DATASTREAM_ID.BIBLIO_MODS, modsCollection, null, null); }
From source file:cz.fi.muni.xkremser.editor.server.newObject.PageBuilder.java
License:Open Source License
/** * {@inheritDoc}//from www. j av a 2 s . c om */ @Override protected void decorateRelsExtStream() { super.decorateRelsExtStream(); Element description = FoxmlUtils.findDescriptionElement(getRelsExtXmlContent()); Element url = description.addElement(new QName("tiles-url", Namespaces.kramerius)); url.addText(getImageUrl() + ".jp2"); }
From source file:cz.fi.muni.xkremser.editor.server.newObject.PeriodicalBuilder.java
License:Open Source License
private void updateDcDoc(Document dcDoc, String pid, String signature, String sysno, DigitalObjectModel model) { Element dcRootEl = dcDoc.getRootElement(); Attribute schemaLoc = dcRootEl.attribute("schemaLocation"); dcRootEl.remove(schemaLoc);/*from www . ja v a 2s . c om*/ Namespace xsi = DocumentHelper.createNamespace("xsi2", FedoraNamespaces.SCHEMA_NAMESPACE_URI); dcRootEl.add(xsi); dcRootEl.addAttribute(new QName("schemaLocation", xsi), "http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd"); XPath typeXpath = Dom4jUtils.createXPath("/oai_dc:dc/dc:identifier"); List<? extends Node> nodes = typeXpath.selectNodes(dcDoc); for (Node node : nodes) { node.detach(); } Element idUuid = dcRootEl.addElement("dc:identifier"); idUuid.addText(pid); for (Node node : nodes) { if (node.getText() != null && !"".equals(node.getText().trim()) && !node.getText().contains(Constants.FEDORA_UUID_PREFIX)) { Element temp = dcRootEl.addElement("dc:identifier"); temp.addText(node.getText()); } } if (signature != null) { Element idSignature = dcRootEl.addElement("dc:identifier"); idSignature.addText("signature:" + signature); } if (sysno != null) { Element idSysno = dcRootEl.addElement("dc:identifier"); idSysno.addText("sysno:" + sysno); } removeDcTypeElements(dcDoc); Element typeEl = dcRootEl.addElement("dc:type"); typeEl.addText("model:" + model.getValue()); Element rightsEl = dcRootEl.addElement("dc:rights"); rightsEl.addText("policy:" + Policy.PUBLIC.toString().toLowerCase()); updateDcLanguages(dcDoc); }