Read the contents of an local XML file in an application and get the whole contents of xml file into a string for blackberry application?
+2
A:
To create a string from a local file see this blackberry forum entry: Open txt file from mediacard
Assuming you want to use the data within the XML, I would recommend using a XML parser rather than string manipulation. The following links should get you going with XML parsers and explain some of the trade-offs:
- Blackberry How To - Use the XML Parser
- Parsing XML in J2ME
- Add XML parsing to your J2ME applications
If, however, you have any say about the format used JSON might be a good alternative. JSON is easy for machines to parse (thus using fewer resources) and it's human readable.
Heinrich Filter
2009-11-14 08:43:56