Example usage for org.dom4j Element addText

List of usage examples for org.dom4j Element addText

Introduction

In this page you can find the example usage for org.dom4j Element addText.

Prototype

Element addText(String text);

Source Link

Document

Adds a new Text node with the given text to this element.

Usage

From source file:com.jaspersoft.jasperserver.export.modules.repository.ResourceExporter.java

License:Open Source License

protected void addResourceIndexElement(String uri) {
    Element folderElement = getIndexElement().addElement(configuration.getResourceIndexElement());
    folderElement.addText(uri);
}

From source file:com.jiangnan.es.orm.mybatis.util.MybatisMapperXmlGenerator.java

License:Apache License

/**
 * ?/*w w  w. j a  v a2s. co  m*/
 * @param root
 */
private void generateUpdate(Element root) {
    root.addComment("");
    Element update = root.addElement("update");
    update.addAttribute("id", UPDATE_ID);
    update.addAttribute("parameterType", this.domainSimpleName);
    //sb.append("\n");
    //sb.append("\t\t");
    update.addText("\n\t\tUPDATE {tableName} ");

    Element set = update.addElement("set");

    //
    int i = 0;
    int fileNameSize = fieldNames.size();
    for (String fieldName : fieldNames) {
        i++;
        Element ifElement = set.addElement("if");
        ifElement.addAttribute("test", fieldName + " != null and " + fieldName + " != ''");
        String text = fieldName.toUpperCase() + " = #{" + fieldName + "}";
        if (i != fileNameSize) {
            text += ",";
        }
        ifElement.setText(text);
    }
    update.addText("\n\t\t WHERE ID = #{id}");
    //sb.append("\n");
}

From source file:com.jswiff.xml.ActionXMLWriter.java

License:Open Source License

private static Element writeUnknown(Element parentElement, UnknownAction action) {
    Element element = parentElement.addElement("unknownaction");
    element.addAttribute("code", Integer.toString(action.getCode()));
    element.addText(Base64.encode(action.getData()));
    return element;
}

From source file:com.jswiff.xml.RecordXMLWriter.java

License:Open Source License

private static void writeAlphaColorMapData(Element parentElement, AlphaColorMapData data) {
    Element element = parentElement.addElement("alphacolormapdata");
    Element colorTableElement = element.addElement("colortable");
    RGBA[] colorTable = data.getColorTableRGBA();
    writeRGBAArray(colorTableElement, colorTable);
    Element pixelDataElement = element.addElement("pixeldata");
    short[] pixelData = data.getColorMapPixelData();
    pixelDataElement.addText(Base64.encodeUnsigned(pixelData));
}

From source file:com.jswiff.xml.RecordXMLWriter.java

License:Open Source License

private static void writeColorMapData(Element parentElement, ColorMapData data) {
    Element element = parentElement.addElement("colormapdata");
    Element colorTableElement = element.addElement("colortable");
    RGB[] colorTable = data.getColorTableRGB();
    writeRGBArray(colorTableElement, colorTable);
    Element pixelDataElement = element.addElement("pixeldata");
    short[] pixelData = data.getColorMapPixelData();
    pixelDataElement.addText(Base64.encodeUnsigned(pixelData));
}

From source file:com.jswiff.xml.RecordXMLWriter.java

License:Open Source License

private static void writePix15Array(Element parentElement, Pix15[] data) {
    Element element = parentElement.addElement("pix15array");
    byte[] buffer = new byte[data.length * 3];
    for (int i = 0; i < data.length; i++) {
        Pix15 pix15 = data[i];// w ww . j av  a  2s.c o  m
        buffer[i * 3] = pix15.getRed();
        buffer[(i * 3) + 1] = pix15.getGreen();
        buffer[(i * 3) + 2] = pix15.getBlue();
    }
    element.addText(Base64.encode(buffer));
}

From source file:com.jswiff.xml.RecordXMLWriter.java

License:Open Source License

private static void writePix24Array(Element parentElement, Pix24[] data) {
    Element element = parentElement.addElement("pix24array");
    short[] buffer = new short[data.length * 3];
    for (int i = 0; i < data.length; i++) {
        Pix24 pix24 = data[i];//from  w w w.  ja v a 2s . c  o m
        buffer[i * 3] = pix24.getRed();
        buffer[(i * 3) + 1] = pix24.getGreen();
        buffer[(i * 3) + 2] = pix24.getBlue();
    }
    element.addText(Base64.encodeUnsigned(buffer));
}

From source file:com.jswiff.xml.RecordXMLWriter.java

License:Open Source License

private static void writeRGBAArray(Element parentElement, RGBA[] data) {
    Element element = parentElement.addElement("rgbaarray");
    short[] buffer = new short[data.length * 4];
    for (int i = 0; i < data.length; i++) {
        RGBA rgba = data[i];/*from  ww w . j  ava2 s .c om*/
        buffer[i * 4] = rgba.getRed();
        buffer[(i * 4) + 1] = rgba.getGreen();
        buffer[(i * 4) + 2] = rgba.getBlue();
        buffer[(i * 4) + 3] = rgba.getAlpha();
    }
    element.addText(Base64.encodeUnsigned(buffer));
}

From source file:com.jswiff.xml.RecordXMLWriter.java

License:Open Source License

private static void writeRGBArray(Element parentElement, RGB[] data) {
    Element element = parentElement.addElement("rgbarray");
    short[] buffer = new short[data.length * 3];
    for (int i = 0; i < data.length; i++) {
        RGB rgb = data[i];/* w  ww. ja  v  a 2  s  .  c o  m*/
        buffer[i * 3] = rgb.getRed();
        buffer[(i * 3) + 1] = rgb.getGreen();
        buffer[(i * 3) + 2] = rgb.getBlue();
    }
    element.addText(Base64.encodeUnsigned(buffer));
}

From source file:com.jswiff.xml.TagXMLWriter.java

License:Open Source License

private static void writeDefineSound(Element parentElement, DefineSound tag) {
    Element element = parentElement.addElement("definesound");
    element.addAttribute("charid", Integer.toString(tag.getCharacterId()));
    element.addAttribute("format", getSoundFormatString(tag.getFormat()));
    element.addAttribute("rate", getSoundRateString(tag.getRate()));
    if (tag.is16BitSample()) {
        element.addAttribute("sample16bit", "true");
    }/*from www . ja  v  a 2  s  .  c  o  m*/
    if (tag.isStereo()) {
        element.addAttribute("stereo", "true");
    }
    element.addAttribute("samplecount", Long.toString(tag.getSampleCount()));
    element.addText(Base64.encode(tag.getSoundData()));
}