The write method is also a lot of Java with little new in the way of XML. The only new concepts here arise in creating the Text Node and appending it to the ColumnXX Node.
// Text Node <- Call Document's createTextNode method // with text from ColumnArray[ColumnNumber] Text texText = docOutput.createTextNode( sbColumnArray[iColumnNumber].toString()); // Free the memory for this column sbColumnArray[iColumnNumber] = null; // Column Element <- Call Column Element's appendChild // to add Text Node as child eleColumn.appendChild(texText); |
As noted above, we call the Document interface's createText method, passing the contents of the ColumnArray entry (implemented as an array of StringBuffers). Then we call the Column Element's appendChild method.