on 12-13-2004 3:31 PM
Hi,
I want to read a file stored in Content Management in /documents/test/myfile.xml. For this I coded the following:
...
...
...
IResource aResource = null;
ResourceContext rContext = new ResourceContext(aUser);
RID aRid = RID.getRID("/documents/test/myfile.xml");
try
{
IResourceFactory aResourceFactory = ResourceFactory.getInstance();
aResource =
ResourceFactory.getInstance().getResource(aRid, rContext);
IContent con = aResource.getContent();
//there I can read the file ..etc..etc.
Now, I want to parse the myfile.xml. For this I made:
...
...
...
String xml = null;
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = null;
try
{
parser = factory.newSAXParser();
}
catch (ParserConfigurationException e3)
{
e3.printStackTrace();
}
catch (SAXException e3)
{
e3.printStackTrace();
}
try
{
parser.parse(<b>xml</b>, new Struct());
}
catch (SAXException e4)
{
e4.printStackTrace();
}
catch (IOException e4)
{
e4.printStackTrace();
}
...
...
...
The XML parser looking for myfile.xml in c:/documents/test/myfile.xml although this file is in Content Management. The http(access) link to myfile.xml is
http://localhost:50000/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/test/myfile.xml
How could I get the real path to myfile.xml(in CM) as regards with above access link ?
Thanks for any feedback or help
Regards.
Altafin
Hi Altafin,
1.) To make it easier to read code, you can set code fragments in [ code ] and [/ code ] (without spaces) to mark it.
2.) The code fragment given won't work for "xml" string being null. I think you have set the xml string to the RID-String?!
3.) Are you sure you want to use SAX-parser?
4.) Just use the InputStream you get from the content to be parsed.
Hope it helps
Detlev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.