E2xCmdline.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:Excel2XML 作者:
/**
 * Writes out an XML cell based on coordinates and provided value
 * 
 * @param row
 *            the row index of the cell
 * @param col
 *            the column index
 * @param cellValue
 *            value of the cell, can be null for an empty cell
 * @param out
 *            the XML output stream
 * @param columns
 *            the Map with column titles
 */
private void writeAnyCell(final int row, final int col, final String cellValue, final XMLStreamWriter out,
        final Map<String, String> columns) {
    try {
        out.writeStartElement("cell");
        String colNum = String.valueOf(col);
        out.writeAttribute("row", String.valueOf(row));
        out.writeAttribute("col", colNum);
        if (columns.containsKey(colNum)) {
            out.writeAttribute("title", columns.get(colNum));
        }
        if (cellValue != null) {
            if (cellValue.contains("<") || cellValue.contains(">")) {
                out.writeCData(cellValue);
            } else {
                out.writeCharacters(cellValue);
            }
        } else {
            out.writeAttribute("empty", "true");
        }
        out.writeEndElement();

    } catch (XMLStreamException e) {
        e.printStackTrace();
    }

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号