美文网首页
kettle 流方式处理XML

kettle 流方式处理XML

作者: felix_feng | 来源:发表于2016-11-29 14:50 被阅读189次
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;

相关文章

网友评论

      本文标题:kettle 流方式处理XML

      本文链接:https://www.haomeiwen.com/subject/pknapttx.html