Skip to Content
0
Former Member
Dec 19, 2007 at 09:37 PM

XML structure from Form Based Published Document

8 Views

Hi experts,

I want to read the contents of a Form Based XML Document to my Web Dynpro project. I'm using this code to do so:

**********************************************************************************************************

wdContext.currentContextElement().setText(wdContext.currentTableContentElement().getObjectName());

readXML(wdContext.currentTableContentElement().getLink());

IWDClientUser wdClientUser = WDClientUser.getCurrentUser();

com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();

//create an ep5 user from the retrieved user

com.sapportals.portal.security.usermanagement.IUser ep5User = WPUMFactory.getUserFactory().getEP5User(sapUser);

IResourceContext context = new ResourceContext(ep5User);

/Specify the path of ur document here./

RID pathRID = RID.getRID(wdContext.currentTableContentElement().getLink());

IResource resource = ResourceFactory.getInstance().getResource(pathRID,context);

InputStream in;

in = resource.getContent().getInputStream();

ByteArrayOutputStream out = new ByteArrayOutputStream();

byte[] buffer = new byte[4096];

int bytesread = 0;

while ((bytesread = in.read(buffer)) != -1) {

out.write(buffer, 0, bytesread);

}

String myData = out.toString();

wdContext.currentContextElement().setText2(myData);

*******************************************************************************

The problem now is: When I'm reading the contents of a Form Based XML Document I'm getting HTML code from the document.

When I try to do the same with an XML document that wasn't created by a XML Form, I get the contents in default XML markup.

My question is: how can I get the Form Based XML Document to my Web Dynpro Project in default XML markup?

Thanks,

Edwin van der Palen