codenameone XML from device -
How do I go about reading XML from a file on the device? Can you add XML to a .res file? I know that XML parser is expecting a reader, but can you use a reader to read the .res file?
Regards,
Delan
Yes, you You can of course open the theme.res file with a codenamed Designer and add your XML file from the data section on the left. Now you can load the file using the topic
object as follows:
InputStream = theme.getData ("yourFile.xml");
Alternatively, you can insert your XML class path (like the Java Source Directory) and load it as follows:
InputStream = Display.getInstance () .getResourceAsStream (empty, "/yourFile.xml");
Once you receive a InputStream
, then it will be a reader
XMLParser XmlParser = new XMLParser (); XmlParser.parse (New InputStreamReader ("UTF-8");
Comments
Post a Comment