use of com.cosylab.logging.engine.VectorNodeList in project ACS by ACS-Community.
the class LogEntryXML method addData.
/**
* Add a data node to this log:
* <Data Name=name>value</Data>
*
* @param name The name, i.e. the key of the pair
* @param value The value of the field
*/
public void addData(String name, String value) {
Document doc = log.getOwnerDocument();
Element ele = doc.createElement("Data");
ele.setAttribute("Name", name);
Text txt = doc.createTextNode(value);
ele.appendChild(txt);
if (datas == null) {
datas = new VectorNodeList(1, 1);
}
datas.add(ele);
}
use of com.cosylab.logging.engine.VectorNodeList in project ACS by ACS-Community.
the class LogEntryXML method initBody.
private void initBody(Node log) throws DOMException {
NodeList list = log.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
Node node = list.item(i);
boolean isData = node.getNodeName().equals("Data");
short type = node.getNodeType();
if (isData) {
DataNode dataNode = new DataNode(node);
if (datas == null) {
datas = new VectorNodeList(1, 2);
}
datas.add(dataNode);
} else {
if (isLogEntrySimple) {
isLogEntrySimple = !node.hasChildNodes();
}
if (isLogEntrySimple) {
// simpleLogEntryMessage = node.getNodeValue();
setField(LogField.LOGMESSAGE, node.getNodeValue());
} else {
if (complexLogEntryMessage == null)
complexLogEntryMessage = new VectorNodeList(1, 2);
complexLogEntryMessage.add(node);
}
}
}
}