<p>I'm new in birt and I am trying to use xml as data source, but I don't get it works. I use with next code:</p><p> </p><div>void buildDataSource() throws SemanticException {</div><div> OdaDataSourceHandle dsHandle = this.efactory.newOdaDataSource("Data Source", "org.eclipse.datatools.enablement.oda.xml");</div><div> dsHandle.setProperty("FILELIST", "<a data-ipb='nomediaparse' href='
http://localhost:8080/BirtIntegrationImproved/ReportXmlDatasource/books.xml'>http://localhost:8080/BirtIntegrationImproved/ReportXmlDatasource/books.xml");</a></div><div> </div><div> this.design.getDataSources().add(dsHandle);</div><div> }</div><div> <span> </span></div><div>void buildDataSet() throws SemanticException {</div><div> OdaDataSetHandle dsHandle = this.efactory.newOdaDataSet("ds","org.eclipse.datatools.enablement.oda.xml.dataSet");</div><div> dsHandle.setDataSource("Data Source");</div><div> </div><div> this.design.getDataSets().add(dsHandle);<span> </span></div><div> } <span> </span> </div><div> </div><div> </div><div> ArrayList<String> cols = new ArrayList<String>(); </div><div> cols.add("id");</div><div> cols.add("author");</div><div> cols.add("title");</div><div> cols.add("genre");</div><div> cols.add("price");</div><div> </div><div> buildDataSource();</div><div> buildDataSet();</div><div> </div><div> TableHandle table = this.efactory.newTableItem("table", cols.size());</div><div> </div><div> table.setWidth("100%");</div><div> table.setDataSet(this.design.findDataSet("ds"));</div><div> PropertyHandle computedSet = table.getColumnBindings();</div><div> ComputedColumn cs1 = null;</div><div> </div><div>for( int i=0; i < cols.size(); i++) {</div><div> cs1 = StructureFactory.createComputedColumn();</div><div> cs1.setName((String)cols.get(i));</div><div> cs1.setExpression("dataSetRow["" + (String)cols.get(i) + ""]");</div><div> computedSet.addItem(cs1);</div><div>} </div><div> </div><div>// table header</div><div>RowHandle tableheader = (RowHandle) table.getHeader().get(0);</div><div>for(int i=0; i < cols.size(); i++) {</div><div> LabelHandle label1 = this.efactory.newLabel((String)cols.get(i));<span> </span></div><div> label1.setText((String)cols.get(i));</div><div> CellHandle cell = (CellHandle) tableheader.getCells().get(i);</div><div> cell.getContent().add(label1);</div><div>}<span> </span></div><div> </div><div>// table detail</div><div>RowHandle tabledetail = (RowHandle) table.getDetail().get(0);</div><div> </div><div>for(int i=0; i < cols.size(); i++) {</div><div> CellHandle cell = (CellHandle) tabledetail.getCells().get(i);</div><div> DataItemHandle data = this.efactory.newDataItem("data_"+(String)cols.get(i));</div><div> data.setResultSetColumn((String)cols.get(i));</div><div> System.out.println("ResultSetColumn: " + data.getResultSetColumn());</div><div> cell.getContent( ).add(data);</div><div>}</div><div> </div><div>can someone help me?</div><div> </div><div>Thannks!!</div>