Hello,
I have th following code:
...
...
...
public void doContent(
IPortalComponentRequest request,
IPortalComponentResponse response)
{
IResource aResource = null;
ResourceContext rContext = new ResourceContext(aUser);
RID aRid = new RID("/documents/test/myfile.xml");
try
{
IResourceFactory aResourceFactory = ResourceFactory.getInstance();
aResource =
ResourceFactory.getInstance().getResource(aRid, rContext);
IContent con = aResource.getContent();
}
catch (AccessDeniedException ex)
{
ex.getLocalizedMessage();
}
catch (com.sapportals.wcm.repository.ResourceException ex)
{
ex.getLocalizedMessage();
}
}
...
...
...
myfile.xml has just a line like "test"
How could I read the myfile.xml content ? I want to get the above string.
Thanks for any feeback
Regards.
Altafin
Hi Altafin,
1.) Just for the code being beautiful: Replace RID aRid = new RID("/documents/test/myfile.xml"); by RID aRid = RID.getRID("/documents/test/myfile.xml");
2.)
InputStream xmlIS = con.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(xmlIS)); String yourLine = br.readLine(); br.close();
etc. pp.
Hope it helps
Detlev
Add a comment