public Text text(String str) { Text t = new Text(); t.value = str; return t; }
public Text text(String text) { return new Text(text); }
/** * This adds text content to this element. It does not replace the * existing content as does <code>setText()</code>. * * @param str <code>String</code> to add * @return this element modified * @throws IllegalDataException if <code>str</code> contains an * illegal character such as a vertical tab (as determined * by {@link org.jdom.Verifier#checkCharacterData}) */ public Element addContent(final String str) { return addContent(new Text(str)); }
public void writeTextContent(String text) throws IOException { this.currentElement.addContent(new Text(text)); }
@Override public Element create(final String scmUrl) { final Element locations = new Element("locations"); final Element scmLocation = new Element("hudson.scm.SubversionSCM_-ModuleLocation"); final Element remote = new Element("remote"); final Text text = new Text(scmUrl); locations.addContent(scmLocation); scmLocation.addContent(remote); remote.addContent(text); return locations; } };
/** * Returns the tag name of the given element (null if the parameter * is not an element). */ public static Text xar (final Content c) { final Element elt = toElement(c); return new Text(elt.getName()); }
private static String encode(String text) { if (text != null) { text = _xmlOutputter.outputString(new Text(text.trim())); } return text; }
protected void add(final String nodename, final String nodetext) { add(nodename,new Text(nodetext)); }
protected void set(final String nodename, final String nodetext) { set(nodename,new Text(nodetext)); }
private static void addProperty(Element systemProperties, Map<String, Element> propertiesByName, String name, String value) { Namespace namespace = systemProperties.getNamespace(); if (!propertiesByName.containsKey(name)) { systemProperties.addContent(new Text(" ")); systemProperties.addContent(new Element("property", namespace).setAttribute("name", name).setAttribute("value", value)); systemProperties.addContent(new Text("\n ")); } }
private static void addProperty(Element systemProperties, Map<String, Element> propertiesByName, String name, String value) { Namespace namespace = systemProperties.getNamespace(); if (!propertiesByName.containsKey(name)) { systemProperties.addContent(new Text(" ")); systemProperties.addContent(new Element("property", namespace).setAttribute("name", name).setAttribute("value", value)); systemProperties.addContent(new Text("\n ")); } }
private static void updateSubsystem(ConfigContext context, boolean enable) { List<Element> profiles = ConfigSupport.findProfileElements(context.getDocument(), NS_DOMAINS); for (Element profile : profiles) { Element element = profile.getChild("subsystem", NS_CAMEL); if (enable && element == null) { URL resource = WildFlyCamelConfigPlugin.class.getResource("/camel-subsystem.xml"); profile.addContent(new Text(" ")); profile.addContent(ConfigSupport.loadElementFrom(resource)); profile.addContent(new Text("\n ")); } if (!enable && element != null) { element.getParentElement().removeContent(element); } } }
private static void updateSubsystem(ConfigContext context, boolean enable) { List<Element> profiles = ConfigSupport.findProfileElements(context.getDocument(), NS_DOMAINS); for (Element profile : profiles) { Element element = profile.getChild("subsystem", NS_CAMEL); if (enable && element == null) { URL resource = WildFlyCamelConfigPlugin.class.getResource("/camel-subsystem.xml"); profile.addContent(new Text(" ")); profile.addContent(ConfigSupport.loadElementFrom(resource)); profile.addContent(new Text("\n ")); } if (!enable && element != null) { element.getParentElement().removeContent(element); } } }
private static void updateExtension(ConfigContext context, boolean enable) { Element extensions = ConfigSupport.findChildElement(context.getDocument().getRootElement(), "extensions", NS_DOMAINS); ConfigSupport.assertExists(extensions, "Did not find the <extensions> element"); Namespace namespace = extensions.getNamespace(); Element element = ConfigSupport.findElementWithAttributeValue(extensions, "extension", "module", "org.wildfly.extension.camel", NS_DOMAINS); if (enable && element == null) { extensions.addContent(new Text(" ")); extensions.addContent(new Element("extension", namespace).setAttribute("module", "org.wildfly.extension.camel")); extensions.addContent(new Text("\n ")); } if (!enable && element != null) { element.getParentElement().removeContent(element); } }
private static void updateExtension(ConfigContext context, boolean enable) { Element extensions = ConfigSupport.findChildElement(context.getDocument().getRootElement(), "extensions", NS_DOMAINS); ConfigSupport.assertExists(extensions, "Did not find the <extensions> element"); Namespace namespace = extensions.getNamespace(); Element element = ConfigSupport.findElementWithAttributeValue(extensions, "extension", "module", "org.wildfly.extension.camel", NS_DOMAINS); if (enable && element == null) { extensions.addContent(new Text(" ")); extensions.addContent(new Element("extension", namespace).setAttribute("module", "org.wildfly.extension.camel")); extensions.addContent(new Text("\n ")); } if (!enable && element != null) { element.getParentElement().removeContent(element); } }
private void updateExtension(ConfigContext context, boolean enable) { Namespace[] domainNamespaces = registry.getNamespaces(NS_DOMAIN); Element extensions = ConfigSupport.findChildElement(context.getDocument().getRootElement(), "extensions", domainNamespaces); ConfigSupport.assertExists(extensions, "Did not find the <extensions> element"); Element element = ConfigSupport.findElementWithAttributeValue(extensions, "extension", "module", "org.switchyard", domainNamespaces); Namespace domainNamespace = context.getDocument().getRootElement().getNamespace(); if (enable && element == null) { extensions.addContent(new Text(" ")); extensions.addContent(new Element("extension", domainNamespace).setAttribute("module", "org.switchyard")); extensions.addContent(new Text("\n ")); } if (!enable && element != null) { element.getParentElement().removeContent(element); } }
protected void generateExampleXml(Value value, org.jdom.Element parent) { DocumentationExample exampleInfo = value.getAnnotation(DocumentationExample.class); if (exampleInfo == null || !exampleInfo.exclude()) { parent.setContent(new Text(exampleInfo == null || "##default".equals(exampleInfo.value()) ? "..." : exampleInfo.value())); } }
/** * Extracts Interactor Name */ private void extractInteractorName(InteractorElementType cProtein, Interactor interactor) throws MapperException { NamesType names = cProtein.getNames(); if (names != null) { String name = MapperUtil.extractName(cProtein, interactor.getExternalRefs()); // Remove all surrounding and internal white space. Text jdomText = new Text(name); name = jdomText.getTextNormalize(); interactor.setName(name); String fullName = names.getFullName(); interactor.addAttribute(InteractorVocab.FULL_NAME, fullName); } }
/** * Extracts Interactor Name */ private void extractInteractorName(ProteinInteractorType cProtein, Interactor interactor) throws MapperException { NamesType names = cProtein.getNames(); if (names != null) { String name = MapperUtil.extractName(cProtein, interactor.getExternalRefs()); // Remove all surrounding and internal white space. Text jdomText = new Text(name); name = jdomText.getTextNormalize(); interactor.setName(name); String fullName = names.getFullName(); interactor.addAttribute(InteractorVocab.FULL_NAME, fullName); } }