FLEX/AS3 - 将 XML 保存到新文件吗?
我打开了一个 XML 文件,并在应用程序内部进行了一些更改,并且我需要能够将其保存到新文件中。
现在我使用这段代码将其保存到同一个文件中:
var fs:FileStream = new FileStream();
fs.open(myOpenXML, FileMode.WRITE);
fs.writeUTFBytes(myXMLString);
fs.close();
如果我跟踪 myXMLString,我会得到正确的格式(XML 中每个对象的新行),但是当我将其保存出来时,所有内容都会在一行上结束。来? 我想保存到一个新文件,我该怎么做? (使用保存对话框)。
我正在使用 Flash Builder。 Flex、AS3、AIR..
非常感谢您的时间和帮助;)
I've got an XML file that I open and do some changes with inside my app, and I need to be able to save it out to a new file.
Now I'm using this code to save it to the same file:
var fs:FileStream = new FileStream();
fs.open(myOpenXML, FileMode.WRITE);
fs.writeUTFBytes(myXMLString);
fs.close();
If I trace myXMLString I get proper formatting (new line for every object in the XML), but when I save it out, everything ends up on one line.. How come?
And I want to save to a new file, how do I do that? (using save dialog box).
I'm using Flash Builder. Flex, AS3, AIR..
Thanks a lot for your time and help ;)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将回答您有关使用“保存”对话框保存到新文件的问题的一部分。您将使用
FileReference
来执行此操作。
这是我从这篇文章复制的片段,我建议您阅读。
I'll answer a part of your question, about saving to a new file using Save Dialog box. You will be using a
FileReference
to do this.Here is a snippet I copied from this article which I suggest you read.