cancel
Showing results for 
Search instead for 
Did you mean: 

Display XML file inside a view in webdynpro

Former Member
0 Kudos

Hi all,

I want diplay a XML file inside a view in webdynpro. I need the particular file to be displayed in XML format.Can anybody help.

Thank you,

Philip Thayil

Accepted Solutions (1)

Accepted Solutions (1)

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Check this code.


String stFile = new String(wdContext.currentContextElement().getVa_File());
try	{
IWDCachedWebResource resource = WDWebResource.getWebResource(stFile.getBytes(), WDWebResourceType.XML);	
IWDWindow window = wdComponentAPI.getWindowManager().createNonModalExternalWindow(resource.getAbsoluteURL(),"MyDoc");
window.removeWindowFeature(WDWindowFeature.TOOL_BAR);
window.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
window.removeWindowFeature(WDWindowFeature.STATUS_BAR);
window.open();
}catch(WDURLException ex){
  wdComponentAPI.getMessageManager().reportException("Exception caused: " + ex, true);
}

Regards,

Vijai

Former Member
0 Kudos

Hi vijyakanna,

Can you please explain some more on code you had written. Can please explain where i need to specify the path of XML file.

Thank you,

Philip Thayil

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

I will check and reply.

Regards,

Vijai

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Check this code.

String stFile ="";
try {
	BufferedReader in = new BufferedReader(new FileReader("D:\Sample.xml"));			
	stFile = in.readLine();
	in.close();
   } catch (IOException e) {
         e.printStackTrace();
   }

Use this stFile in the code above.

Remove this line.

String stFile = new String(wdContext.currentContextElement().getVa_File());

Regards,

Vijai

Former Member
0 Kudos

Hi vijai,

IWDCachedWebResource resource = WDWebResource.getWebResource(stFile.getBytes(), WDWebResourceType.XML);

Here the getWebResource is depricated. I tried but it is printing null page.

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Which version of NWDS are u uding? I am using NWDS SP16. It is not deprecated in it. I have worked with that fine.

Regards,

Vijai

Former Member
0 Kudos

Hi vijaya,

In my version this is the form what is deployable object part

WDWebResource.getWebResource(deployableObjectPart, resourceType, resourceName)

Thank you,

Philip Thayil

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

In the same class, this method is also available.

public static IWDCachedWebResource getWebResource(byte[] webResource, WDWebResourceType resourceType) ;

By default, it would have taken that line. Delete the whole line. Type it and make sure, u select this method. It works for me.

Regards,

Vijai

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Was my answer useful or u need more help? If ur question is solved, please close the thread.

Regards,

Vijai

Former Member
0 Kudos

Hi Philip,

Try linkToURL UI element.

Specify values for property text and reference.

For reference specify your file path.

Answers (0)