tags:

views:

116

answers:

1

Hello Everyone.

Can anyone help me with code for converting an xml document into string in blackberry JDE 4.7 I wanted the complete xml document into a single String.

Thanks...

+1  A: 

This could be done with DataInputStream#readUTF() rather easily. Or if you want a little more control you could use DataInputStream.readChar(), put the returned chars in a StringBuffer and then convert the StringBuffer into a String once reading is complete. A short uncompiled code example follows:

try {
    Connection con = Connector.open(path);
    if(con instanceof FileConnection) {
        DataInputStream dis = ((FileConnection)con).openDataInputStream();
        String strFile = dis.readUTF();
    }
} catch(...) {
    ...
} finally {
    ...
}
Fostah