cancel
Showing results for 
Search instead for 
Did you mean: 

Help - Accesing to a document content using xpath

aique
Champ in-the-making
Champ in-the-making
Hi!.

I have some nodes in the company directory. There are plain text files.

I'm using xpath to access to each node, but I want to get the content of the text files, and I can't.

I've tried to do it using node.getProperty("cm:content").getString(), but it returns information about the properties of the file.

¿How can I access to the content of a plain text file in the reposiyory?.

Thanks!.
3 REPLIES 3

invictus9
Champ in-the-making
Champ in-the-making
node.content

aique
Champ in-the-making
Champ in-the-making
Thanks for your reply, but it seems to be not so easy.

The javax.jcr.Node class doesn't have a content() or getContent() method.

Here is the spec: http://www.day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/Node.html

Anyone have more ideas?, Thanks.

aique
Champ in-the-making
Champ in-the-making
I've solved it.

Here's the code:

String contenido = "";
InputStream stream = noticia.getProperty("cm:content").getStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
String linea;
while((linea = reader.readLine()) != null){
    contenido += contenido + linea;
}