ActionScript3 中 TextField 中的 XML
我做了一个简单的项目,将 XML 粘贴到 TextField 中并使用它。它工作得很好,但是它没有保留原始结构,这并不是什么大问题,直到我最近注意到如果我加载或复制并粘贴包含以下注释的 XML:
//<min>0.0</min>
//<max>255.0</max>
在 TextField 中,它会变成这样:
//
<min>0.0</min>
//
<max>255.0</max>
这会产生问题我可以告诉它然后会运行它不应该运行的代码行。我希望它保持相同的文本结构,因为加载/复制和粘贴方法似乎会出于某种原因对其进行调整。
所以我的主要问题是你能保持完全相同的 XML 文本结构和工作注释吗?
我注意到的另一个问题是,当 XML 位于 TextField 中时,它会删除这部分:
<?xml version="1.0" encoding="UTF-8"?>
所以我的其他问题是为什么它会删除该部分而不是保持文本完全相同?我可以让它保留它还是我必须再次手动附加该文本?
I made a simple project which you paste XML into a TextField and and uses this. It works great however it doesn't keep the original structure which wasn't much of a problem until i recently noticed if i load or copy and paste XML which contain comments like:
//<min>0.0</min>
//<max>255.0</max>
In the TextField it turns to this:
//
<min>0.0</min>
//
<max>255.0</max>
Which creates problems as from what i can tell it would then run lines of code it should not. I would prefer if it kept the same text structure as the loading/copy and paste method seems to adjust it for some reason.
So my main question is can you keep the exact same XML text structure with working comments?
Another problem i noticed is when the XML is in the TextField it removes this part:
<?xml version="1.0" encoding="UTF-8"?>
So my other questions are why does it remove that rather than keeping the text exactly the same? and can i make it keep that or would i have to manually append that text again?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您想查看 XML.ignoreProcessingInstructions, XML.ignoreComments、XML.prettyPrinting、XML.prettyIndent 和 XML.ignoreWhitespace。
另外,双斜杠
//
不会在 XML 中标记注释 - 它们应该如下所示:You want to look at XML.ignoreProcessingInstructions, XML.ignoreComments, XML.prettyPrinting, XML.prettyIndent and XML.ignoreWhitespace.
Also, the double slash
//
does not mark comments in XML - they should look like this: