use of org.pentaho.di.trans.steps.xmlinputsax.XMLInputSaxFieldRetriever in project pentaho-kettle by pentaho.
the class XMLInputSaxDialog method get.
//
private void get() {
try {
XMLInputSaxMeta meta = new XMLInputSaxMeta();
getInfo(meta);
// OK, let's try to walk through the complete tree
List<XMLInputSaxField> fields = new ArrayList<XMLInputSaxField>();
// Keep the list of positions
String[] filePaths = meta.getFilePaths(transMeta);
if (meta.getInputPosition().length == 0) {
// error
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(BaseMessages.getString(PKG, "XMLInputSaxDialog.Dialog.NoElements.Message"));
mb.setText(BaseMessages.getString(PKG, "XMLInputSaxDialog.Dialog.NoElements.Title"));
mb.open();
return;
}
for (int f = 0; f < filePaths.length; f++) {
XMLInputSaxFieldRetriever fieldRetreiver = new XMLInputSaxFieldRetriever(log, filePaths[f], meta);
fields = fieldRetreiver.getFields();
// add the values to the grid...
for (int i = 0; i < fields.size(); i++) {
XMLInputSaxField iF = fields.get(i);
TableItem item = new TableItem(wFields.table, SWT.NONE);
item.setText(1, iF.getName());
item.setText(2, iF.getTypeDesc());
item.setText(11, iF.getFieldPositionsCode(meta.getInputPosition().length));
}
wFields.removeEmptyRows();
wFields.setRowNums();
wFields.optWidth(true);
}
} catch (KettleException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "XMLInputSaxDialog.Dialog.ErrorParsingInputData.Title"), BaseMessages.getString(PKG, "XMLInputSaxDialog.Dialog.ErrorParsingInputData.Message"), e);
System.out.println(e.getMessage());
}
}
Aggregations