kettle 流方式处理XML
2016-11-29 本文已影响189人
felix_feng
fileInputStream = new java.io.FileInputStream(filename);
contentBytes = Packages.org.pentaho.di.core.Const.createByteArray(fileInputStream.available());
fileInputStream.read(contentBytes);
fileInputStream.close();
var contentString = new java.lang.String(contentBytes);
contentString = contentString.replaceFirst("<\\?xml[^>]*\\?>\\s*", "");
var contentXML = new XML(contentString);
level3ID2Values = contentXML.levelTwo.level3.(@id == "2").@value;
var level3ID2Value = "";
for each (var value in level3ID2Values)
{
level3ID2Value = value;
newRow = createRowCopy(getOutputRowMeta().size());
newRow[getInputRowMeta().size()] = java.lang.Double.valueOf(level3ID2Value);
putRow(newRow);
}
// Don't output the input row.
trans_Status = SKIP_TRANSFORMATION;