Actionscript 3 E4X 处理 XML 中的命名空间值
我正在使用 Action script 3 构建一个应用程序,我正在从 Web 检索一些 XML,但节点名称为 mms:Image mms:Results 等,我的操作脚本编译器抛出错误,因为它不希望在节点中看到分号姓名。如何访问节点?
谢谢
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这些是 XML 命名空间,使用起来很麻烦。请查看有关使用 XML 命名空间的 Adobe 文档。
基本上,您必须获取名称空间:
然后当您想要获取它所应用到的节点时使用它:
如果所有 xml 都位于特定名称空间中,则快捷方式是设置默认名称空间:
编辑:< /strong> 您尝试访问的 XML 命名空间必须在 XML 片段中声明:
查看 w3c 文档中的 XML 命名空间 确保您的文档格式良好(甚至可以通过验证器传递它)。
Those are XML namespaces and they can be a pain to use. Have a look at the Adobe documentation on Using XML namespaces.
Basically you have to get the namespace:
And then use it when you want to get the nodes that it is applied to:
A shortcut if all of your xml is in a particular namespace is to set the default namespace:
edit: The XML namespace you are trying to access must be declared within the XML fragment:
Have a look at the w3c docs for XML Namespaces to ensure your document is well-formed (maybe even pass it through a validator).