List of usage examples for org.jdom2 CDATA CDATA
public CDATA(final String string)
CDATA
node, with the supplied string value as its character content. From source file:io.smartspaces.master.server.services.internal.support.JdomMasterDomainModelCreator.java
License:Apache License
/** * Create the entry for a specific live activity group. * * @param group//from w w w.jav a2 s . com * the live activity group to write * * @return the element for the live activity group */ private Element newLiveActivityGroupEntry(LiveActivityGroup group) { Element groupElement = new Element(ELEMENT_NAME_INDIVIDUAL_LIVE_ACTIVITY_GROUP); groupElement.setAttribute(ATTRIBUTE_NAME_ID, group.getId()) .addContent(new Element(ELEMENT_NAME_NAME).addContent(new CDATA(group.getName()))) .addContent(new Element(ELEMENT_NAME_DESCRIPTION).addContent(new CDATA(group.getDescription()))) .addContent(newMetadataElement(group.getMetadata())); addLiveActivityGroupLiveActivities(group, groupElement); return groupElement; }
From source file:io.smartspaces.master.server.services.internal.support.JdomMasterDomainModelCreator.java
License:Apache License
/** * Create the entry for a specific space. * * @param space// w ww.j a v a 2 s . c o m * the space to write * * @return the element for the space */ private Element newSpaceEntry(Space space) { Element spaceElement = new Element(ELEMENT_NAME_INDIVIDUAL_SPACE); spaceElement.setAttribute(ATTRIBUTE_NAME_ID, space.getId()) .addContent(new Element(ELEMENT_NAME_NAME).addContent(new CDATA(space.getName()))) .addContent(new Element(ELEMENT_NAME_DESCRIPTION).addContent(new CDATA(space.getDescription()))) .addContent(newMetadataElement(space.getMetadata())); addSubspaces(space, spaceElement); addSpaceLiveActivityGroups(space, spaceElement); return spaceElement; }
From source file:io.smartspaces.master.server.services.internal.support.JdomMasterDomainModelCreator.java
License:Apache License
/** * Create the entry for a specific named script. * * @param script//from w w w . j a v a 2s .co m * the named script to write * * @return the XML element for the named script */ private Element newNamedScriptEntry(NamedScript script) { Element scriptElement = new Element(ELEMENT_NAME_INDIVIDUAL_NAMED_SCRIPT); scriptElement.setAttribute(ATTRIBUTE_NAME_ID, script.getId()) .addContent(new Element(ELEMENT_NAME_NAME).addContent(new CDATA(script.getName()))) .addContent(new Element(ELEMENT_NAME_DESCRIPTION).addContent(new CDATA(script.getDescription()))) .addContent(new Element(ELEMENT_NAME_NAMED_SCRIPT_LANGUAGE).addContent(script.getLanguage())) .addContent( new Element(ELEMENT_NAME_NAMED_SCRIPT_CONTENT).addContent(new CDATA(script.getContent()))) .addContent(newMetadataElement(script.getMetadata())); Element scheduleElement = new Element(ELEMENT_NAME_NAMED_SCRIPT_SCHEDULE) .addContent(new CDATA(script.getSchedule())); scheduleElement.setAttribute(ATTRIBUTE_NAME_NAMED_SCRIPT_SCHEDULE_SCHEDULED, script.getScheduled() ? VALUE_TRUE : VALUE_FALSE); scriptElement.addContent(scheduleElement); return scriptElement; }
From source file:io.smartspaces.master.server.services.internal.support.JdomMasterDomainModelCreator.java
License:Apache License
/** * Create a metadata element./*from w ww. j a v a 2 s .co m*/ * * @param metadata * the metadata to create the XML for * * @return the XML description of the metadata */ private Element newMetadataElement(Map<String, Object> metadata) { Element metadataElement = new Element(ELEMENT_NAME_METADATA); for (Entry<String, Object> entry : metadata.entrySet()) { metadataElement.addContent(new Element(ELEMENT_NAME_METADATA_ITEM) .setAttribute(ATTRIBUTE_NAME_METADATA_ITEM_NAME, entry.getKey()) .addContent(new CDATA(entry.getValue().toString()))); } return metadataElement; }
From source file:io.wcm.handler.commons.dom.Script.java
License:Apache License
/** * {@inheritDoc} Overrides standard setText method to add special xHTML conformant CDATA block * as workaround for browsers that does not interpret XHTML-encoded script blocks correctly. *///www .j a va 2 s .co m @Override public Element setText(String script) { if (StringUtils.isEmpty(script)) { super.setText(script); } else { this.addContent(new Text("\n//")); // encapsulate script block in CDATA block this.addContent(new CDATA("\n" + script + "\n//")); this.addContent("\n"); } return this; }
From source file:nl.nn.adapterframework.util.XmlBuilder.java
License:Apache License
public void setCdataValue(String value) { if (value != null) { element.setContent(new CDATA(value)); } }
From source file:org.openflexo.foundation.help.HelpElementBuilder.java
License:Open Source License
private static Element buildSpecificDescriptionElement(FlexoObject o) { if (o.getSpecificDescriptions().size() > 0) { Element specificDescriptions = new Element("specificDescriptions"); for (Entry<String, String> e : o.getSpecificDescriptions().entrySet()) { String k = e.getKey(); String help = e.getValue(); Element element = new Element(k); element.addContent(new CDATA(help)); specificDescriptions.addContent(element); }//from w w w.j a va 2 s. co m return specificDescriptions; } return null; }
From source file:org.openflexo.foundation.help.HelpElementBuilder.java
License:Open Source License
private static Element buildDescriptionElement(FlexoObject o) { if (o.hasDescription()) { Element description = new Element("description"); description.addContent(new CDATA(o.getDescription())); return description; }/* ww w . j ava 2s . c o m*/ return null; }
From source file:org.plasma.sdo.xml.DocumentMarshaller.java
License:Open Source License
private void addContent(Element element, DataObject dataObject) { for (Property property : dataObject.getType().getDeclaredProperties()) { PlasmaProperty prop = (PlasmaProperty) property; if (!prop.getType().isDataType()) continue; Object value = dataObject.get(prop); if (value == null) continue; if (prop.isXMLAttribute()) { element.setAttribute(//from w w w . j a va2 s. c o m new Attribute(PlasmaXSDHelper.INSTANCE.getLocalName(prop), String.valueOf(value))); } else { Element propertyElement = new Element(PlasmaXSDHelper.INSTANCE.getLocalName(prop)); propertyElement.addContent(new CDATA(String.valueOf(value))); element.addContent(propertyElement); } } }
From source file:org.plasma.xml.uml.DefaultUMLModelAssembler.java
License:Open Source License
private void addOwnedComment(Element owner, String ownerId, String commentBody) { Element comment = new Element("ownedComment"); owner.addContent(comment);/*from w w w . j a v a2s . co m*/ comment.setAttribute(new Attribute("type", "uml:Comment", xmiNs)); comment.setAttribute(new Attribute("id", UUID.randomUUID().toString(), xmiNs)); Element body = new Element("body"); comment.addContent(body); body.addContent(new CDATA(commentBody)); Element annotatedElement = new Element("annotatedElement"); comment.addContent(annotatedElement); annotatedElement.setAttribute(new Attribute("idref", ownerId, xmiNs)); }