How to read the data from emf [message #340240] |
Thu, 24 January 2008 08:40 |
Li Junhong Messages: 1012 Registered: July 2009 |
Senior Member |
|
|
Hi All,
Now I have an EMF Model file(.xml type), in which exsiting some info I
want to add them to a table in rptdesign file. So I pass the file uri to a
DataInput(I create it to get the info from EMF Model file) constructor in
the open() function of dataset script, it is successful. And then I want
call the readData() method of the DataInput class, in this method, I call
some methods of EMF, in order to get the data, just as following:
URI fileURI = URI.createFileURI(url); //this url indicates the EMF file
Resource modeResource = resourceSet.getResource(fileURI, true);
EList<EObject> contents = modeResource.getContents();
for (int i = 0; i < contents.size(); i++) {
DocumentRoot root = (DocumentRoot) contents.get(i); //Throw Exception
......
}
But when i preview this report, it throw java.lang.ClassCastException from
the code in the for() sentence.
I'm not very clear that how to read the data from an EMF file, is anybody
familiar with EMF and BIRT can give me some advice or sample to pull me
out of dark?
Thanks very much!!~
Lee
|
|
|
Powered by
FUDForum. Page generated in 0.02915 seconds