Skip to Content
author's profile photo Former Member
Former Member

path to CM file

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Dec 13, 2004 at 04:05 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.