cancel
Showing results for 
Search instead for 
Did you mean: 

Read XML file in folder /src/mime...

Former Member
0 Kudos

Hello,

I got a XML file with some data which I need for my application. I put the file in the folder: src/mime/components/com.sap.test/mydata.xml

I also tried src/packages/com/sap/test/mydata.xml

How can I access this file?

e.g. I tried

InputStream is = getClass().getClassLoader().getResourceAsStream("mydata.xml");

Thanks

Rene

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI Rene,

Let the xml file be mydata.xml inside src/mime/components/com.sap.test/

To access to this file,

String url=WDURLGenerator.getResourcePath(wdComponentAPI.getComponent().getDeployableObjectPart(),"mydata.xml");

File f=new File(url);

try

{

FileInputStream fos=new FileInputStream(url);

}

catch (Exception e)

{

wdComponentAPI.getMessageManager().reportException("While reading file "+e,true);

}

Regards,

Fahad Hamsa

Answers (1)

Answers (1)

Former Member
0 Kudos

chk it