use of org.geotoolkit.swe.xml.v101.Text in project CodenameOne by codenameone.
the class JDomContentHelper method isMultiNewLine.
/**
* Check if content is a multiline text, i.e. \n\n (or more).<br>
* * Maybe followed by an empty string.
*
* @param content the content to check
* @return boolean
*/
static boolean isMultiNewLine(Content content) {
if (content instanceof Text) {
Text text = (Text) content;
String value = text.getValue();
return StringUtils.countMatches(value, "\n") > 1 && value.trim().length() == 0;
}
return false;
}
use of org.geotoolkit.swe.xml.v101.Text in project CodenameOne by codenameone.
the class JDomConfiguration method recAddChild.
private void recAddChild(Element parent, Xpp3Dom child) {
Element targetChild = insertNewElement(child.getName(), parent);
targetChild.setContent(new Text(child.getValue()));
for (String attrName : child.getAttributeNames()) {
targetChild.setAttribute(attrName, child.getAttribute(attrName));
}
for (Xpp3Dom grandChild : child.getChildren()) {
recAddChild(targetChild, grandChild);
}
}
use of org.geotoolkit.swe.xml.v101.Text in project CodenameOne by codenameone.
the class JDomModules method add.
@Override
public boolean add(String module) {
Element newModule = new Element(POM_ELEMENT_MODULE, jdomElement.getNamespace());
newModule.setText(module);
jdomElement.addContent(jdomElement.getContentSize() - 1, asList(new Text("\n" + detectIndentation(jdomElement)), newModule));
return super.add(module);
}
use of org.geotoolkit.swe.xml.v101.Text in project jspwiki by apache.
the class CreoleRenderer method renderElement.
/**
* Renders an element into the StringBuilder given
* @param ce element to render
* @param sb stringbuilder holding the element render
*/
private void renderElement(final Element ce, final StringBuilder sb) {
String endEl = EMPTY_STRING;
for (int i = 0; i < ELEMENTS.length; i += 3) {
if (ELEMENTS[i].equals(ce.getName())) {
sb.append(ELEMENTS[i + 1]);
endEl = ELEMENTS[i + 2];
}
}
if (UL.equals(ce.getName())) {
m_listCount++;
m_listChar = '*';
} else if (OL.equals(ce.getName())) {
m_listCount++;
m_listChar = '#';
} else if (LI.equals(ce.getName())) {
for (int i = 0; i < m_listCount; i++) sb.append(m_listChar);
sb.append(ONE_SPACE);
} else if (A.equals(ce.getName())) {
final String href = ce.getAttributeValue(HREF_ATTRIBUTE);
final String text = ce.getText();
if (href.equals(text)) {
sb.append(HREF_START).append(href).append(HREF_END);
} else {
sb.append(HREF_START).append(href).append(HREF_DELIMITER).append(text).append(HREF_END);
}
// Do not render anything else
return;
} else if (PRE.equals(ce.getName())) {
sb.append(PRE_START);
sb.append(ce.getText());
sb.append(PRE_END);
return;
}
// Go through the children
for (final Content c : ce.getContent()) {
if (c instanceof PluginContent) {
final PluginContent pc = (PluginContent) c;
if (pc.getPluginName().equals(PLUGIN_IMAGE)) {
sb.append(IMG_START).append(pc.getParameter(PARAM_SRC)).append(IMG_END);
} else {
m_plugins.add(pc);
sb.append(PLUGIN_START).append(pc.getPluginName()).append(ONE_SPACE).append(m_plugins.size()).append(PLUGIN_END);
}
} else if (c instanceof Text) {
sb.append(((Text) c).getText());
} else if (c instanceof Element) {
renderElement((Element) c, sb);
}
}
if (UL.equals(ce.getName()) || OL.equals(ce.getName())) {
m_listCount--;
} else if (P.equals(ce.getName())) {
sb.append(LINEBREAK);
}
sb.append(endEl);
}
use of org.geotoolkit.swe.xml.v101.Text in project mule-migration-assistant by mulesoft.
the class AbstractResponseBuilderMigrationStepTestCase method assertBasicStructure.
protected Text assertBasicStructure(Element element) {
assertThat(element.getName(), is(SET_RESPONSE_TAG_NAME));
assertThat(element.getNamespace(), is(HTTP_TRANSFORM_NAMESPACE));
assertThat(element.getAttributes().size(), is(1));
assertThat(element.getContentSize(), is(1));
Element headersElement = (Element) element.getContent().get(0);
assertThat(headersElement.getName(), is(HEADERS_TAG_NAME));
assertThat(headersElement.getNamespace(), is(HTTP_TRANSFORM_NAMESPACE));
assertThat(headersElement.getContentSize(), is(1));
return (Text) headersElement.getContent().get(0);
}
Aggregations