cancel
Showing results for 
Search instead for 
Did you mean: 

How I can read a File from WD?

Former Member
0 Kudos

I Need to read a xml from a web dynpro, then I execute

File file = new File("file.xml"), but a java.io.FileNotFoundException was throwed

I try with "/file.xml" but nothing...

Where I need to put the file? How can I do for read it?

Thank you

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You need to use the FileUpload UI element. Check [this|https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/4739] [original link is broken] [original link is broken] [original link is broken]; blog.

Regards,

Satyajit

Former Member
0 Kudos

I need to read a file.xml like a some configuration in wd. File doesn't relate with the view.

Former Member
0 Kudos

In that case, put the xml file under "src/mimes/Components/<path to your component>". So if the file is called "NewFile.xml" the code would look like:


try {
String xmlUrl = WDURLGenerator.getResourcePath(wdComponentAPI.getComponent().getDeployableObjectPart(),
 "NewFile.xml");
if(xmlUrl != null){
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new File(xmlUrl));
}

Regards,

Satyajit

Former Member
0 Kudos

Thank you, I use a class from Hibernate

ConfigHelper.findAsResource("file.xml").openStream()

Works independent of WD.

Answers (0)