Hi there
I am trying to create a simple xml document.
I have never found a good documentation about it, so I just try it like this:
Element response = new Element("Artikelliste");
Element artikel1 = new Element("Artikel");
Element artikel2 = new Element("Artikel");
artikel1.setAttribute("nummer", "5678");
artikel1.setAttribute("bezeichnung", "KettenhandschuhXML");
artikel2.setAttribute("nummer", "1011");
artikel2.setAttribute("bezeichnung", "MesserXML");
response.addChild(artikel1);
response.addChild(artikel2);
OutputStream os =
Storage.getInstance().createOutputStream("test1234.xml");
OutputStreamWriter writer = new OutputStreamWriter(os);
XMLWriter xmlWriter = new XMLWriter(false);
xmlWriter.writeXML(writer, response);
FileSystemStorage.getInstance().openOutputStream("test1234.xml").write(response.toString().getBytes());
I'm currently getting an IllegalArgumentException because of the last line,
which says:test1234.xml is not a valid path, use
FileSystemStorage.getInstance().getAppHomePath() to get a valid dir path to
read / write files
If I correct the corresponding line it looks like this:
FileSystemStorage.getInstance().openOutputStream(*FileSystemStorage.getInstance().getAppHomePath()*).write(response.toString().getBytes());
But the program cannot know which document is meant??! When I run the code like
this, there is no error message and nothing happens...
Thanks for help! :)
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/319b32a2-b8f3-4ae0-9d91-dfb12b82ca05%40googlegroups.com.