[codenameone-discussions] Re: Generate XML file with XMLWriter

2019-04-11 Thread Shai Almog
Try this: try(OutputStream os = FileSystemStorage.getInstance().openOutputStream(path+""+"test.xml"); OutputStreamWriter writer = new OutputStreamWriter(os)) { xw.writeXML(writer, root); writer.close(); }

[codenameone-discussions] Re: Generate XML file with XMLWriter

2019-04-11 Thread pythoudk
Yes, I want to create an XML file and save it to the phone. For the moment, it is saved in the .cn/ repertory of my PC and when I open it for check, it is empty and no tag is there On Thursday, April 11, 2019 at 4:14:09 AM UTC+2, Shai Almog wrote: > > Both methods lead to the same block: >

[codenameone-discussions] Re: Generate XML file with XMLWriter

2019-04-10 Thread pythoudk
Yes it works. But how to generate XML file and write tag into with XMLWriter ? With my code and toXML() method, that isn't work. On Tuesday, April 9, 2019 at 8:46:18 PM UTC+2, pyth...@gmail.com wrote: > > Hi, > I have some problems to generate an XML file, the file is created but the > root

[codenameone-discussions] Re: Generate XML file with XMLWriter

2019-04-09 Thread Shai Almog
I just tried this: Form hi = new Form("XML", BoxLayout.y()); Button write = new Button("Write"); hi.add(write); write.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { Element root = new Element("root"); XMLWriter xw = new