on 02-11-2009 11:38 AM
Hi Experts,
Does any one have the idea about reading the XML file from the KM location.
I have a Web Dynpro running in portal, which reads the XML file from within Web Dynpro server's location.
For this I am using java.io.File and DOM parser to read the XML file. But now my iView needs to read this XML file KM.
I found some api's in SDN to be used to access the KM files
bc.rf.framework_api.jar
bc.rf.global.service.urlgenerator_api.jar
bc.sf.framework_api.jar
bc.util.public_api.jar
Can any one please provide me the sample code to access XML file.
Thanks in Advance
Chinna.
Hi,
Following document explains how to access KM from Wd
Once the document is available in Webdynpro. Use the DOM or SAX to parse it and load the values to respective context attribute.
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ayyapparaj,
I followed the docuement and tried to run the demo application. When I run the application, it is throwing
java.lang.NoClassDefFoundError: com/sap/tc/webdynpro/clientserver/uielib/standard/api/IWDAbstractTableColumn exception. I did set the class path of all the jar files, even then it is giving this error.
I have deleted the Table control and run the application with static document location. It is finding the resource location.
Because I know the path of the document in design time itself, I can fix the path of the document. As shown in the below code.
wdComponentAPI.getMessageManager().reportSuccess("in refreshtable");
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();
//create an ep5 user from the retrieved user
IUser ep5User = WPUMFactory.getUserFactory().getEP5User(sapUser);
//establish resource context
IResourceContext resourceContext = new ResourceContext(ep5User);
//get a resource factory
IResourceFactory resourceFactory = ResourceFactory.getInstance();
//get a RID from the current path to display the according content
//RID pathRID = RID.getRID(wdContext.currentContextElement().getPath());
RID pathRID = RID.getRID("/documents/TestFolder/Test.xml");
But my problem is, because I am using the java.io.File stream and DOM object to parse the XML file in my existing iView, I want to use the reading part as it is as shown in below. code
File file = new File("Test.xml");//Which picks up from server location
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(file);
Can you please give me some suggestions on how to approach
Thanks,
Chinna
Edited by: Chinna Babu on Feb 12, 2009 3:24 AM
HI
This exception indicates that you run an application on a Web AS where the interface IWDAbstractTableColumn does not exist (e.g.a NW04 server).
Probably you deployed an application created with NW04s (7.0) on a NW04 (6.40) server.
Also try to put required jar file into lib folder of your application
thanks
Hi Anup Bharti,
You may be exactly correct because I have deployed this application on WAS 6.4.
But, here my requirement is not to recurse the folders/files inside the KM. I have an XML file, where I know the path in design time itself.
I am using DOM parser to parse and read the XML file and for this parser I can feed either java.io.File path or Input stream.
Could please give me some suggestions for the above approach.
Thanks,
Chinna.
try this
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse("http://localhost:8084/XmlApplication1/sss.xml");
String name = "Banglore";
NodeList nlst = doc.getElementsByTagName("name");
Node node= nlst.item(0).getFirstChild();
// Node nod2=node.getFirstChild();
node.setNodeValue(name);
}
catch(Exception e)
{
out.println(e) ;
}
for more details check this
/thread/5362171 [original link is broken]
Hi All,
My issue has been solved with the following piece of code
IResourceContext resourseContext = new ResourceContext(ep5User);
com.sapportals.wcm.repository.IResource resource = ResourceFactory.getInstance().getResource(rid, resourseContext);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(*resource.getContent().getInputStream()*);
doc.getDocumentElement().normalize();
Thanks for all your replies.
Chinna.
See the below link...might help you..
Thanks,
Prasanthi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.