Example usage for org.xml.sax.helpers AttributesImpl removeAttribute

List of usage examples for org.xml.sax.helpers AttributesImpl removeAttribute

Introduction

In this page you can find the example usage for org.xml.sax.helpers AttributesImpl removeAttribute.

Prototype

public void removeAttribute(int index) 

Source Link

Document

Remove an attribute from the list.

Usage

From source file:org.cloudata.core.rest.CloudataRestService.java

private static void makeRowXml(Row row, XmlWriter resultDoc) throws SAXException {
    AttributesImpl attr = new AttributesImpl();
    attr.addAttribute("", "key", "", "", row.getKey().toString());
    resultDoc.startElement("", "row", "", attr);
    attr.removeAttribute(0);

    String[] columns = row.getColumnNames();
    for (int i = 0; i < columns.length; i++) {
        makeColumnXml(row, columns[i], resultDoc);
    }// w  ww  .  j ava 2  s. com
    resultDoc.endElement("row");
}

From source file:org.cloudata.core.rest.CloudataRestService.java

private static void makeColumnXml(Row row, String columnName, XmlWriter resultDoc) throws SAXException {
    List<Cell> columnCells = row.getCellList(columnName);

    AttributesImpl attr = new AttributesImpl();

    attr.addAttribute("", "name", "", "", columnName);
    resultDoc.startElement("", "column", "", attr);
    attr.removeAttribute(0);

    for (Cell cell : columnCells) {
        attr.addAttribute("", "key", "", "", cell.getKey().toString());
        resultDoc.startElement("", "cell", "", attr);
        attr.removeAttribute(0);//from w  w  w  .  ja  va 2 s .co  m

        attr.addAttribute("", "timestamp", "", "", Long.toString(cell.getValue().getTimestamp()));
        resultDoc.dataElement("", "value", "", attr, cell.getValue().getValueAsString());
        attr.removeAttribute(0);
        /*
         * without timeStamp resultDoc.dataElement("value",
         * cell.getValue().getValueAsString()); resultDoc.endElement("cell");
         */
        resultDoc.endElement("cell");
    }
    resultDoc.endElement("column");
}

From source file:org.dita.dost.util.XMLUtils.java

/**
 * Remove an attribute from the list. Do nothing if attribute does not exist.
 * /*from  w  ww .j  a  va  2s .  c  om*/
 * @param atts attributes
 * @param qName QName of the attribute to remove
 */
public static void removeAttribute(final AttributesImpl atts, final String qName) {
    final int i = atts.getIndex(qName);
    if (i != -1) {
        atts.removeAttribute(i);
    }
}