| 首页 | 新闻 | 网页 | 设计 | 色彩 | 原创 | 视觉 | 素材 | 动漫 | 酷站 | 策划 | 文案 | 访谈 | 运营 | 编程 | 数据库 | 服务器 | 下载 | 图库 | 
您的位置: 幽幽天空 > 网页 > 网页制作 > Flash教程 > ActionScript教程 > 文章正文 用户登录
以太网络提供200M
FLASH调用XML数据
XMLSocket 渐进 (
一个很实用的基于
不需要Flex也可以
XML connector的讨
Flash MX2004中的
flah+xml做的扩展
读取XML当中的HTM
实战Flash mx 200

xml 中 nodeValue 的用意           

xml 中 nodeValue 的用意

作者:佚名 来源:闪吧 作者: holybozo 更新:2007-1-13 20:47:37 错误报告 我要投稿

xml在flash中的nodeValue,是返回节点值,先看下帮助. nodeValue是取得文字节点的值,而文字节点就是一个不包含任何其它节点的元素. (关于文字节点可以查看帮助XML中nodeName , nodeType , nodeValue)3个部分 虽然一般情况下,直接取文字节点和取该文字节点的值是等同的.也就是说下面代码显示的是同样的东西
// xml code
<?xml version="1.0"?>
<root>
Welcome to HBBlog!
</root>
// flash code
var txt_xml:XML = new XML();
txt_xml.ignoreWhite = true;
txt_xml.onLoad = function(success) {
if (success) {
root= txt_xml.firstChild.firstChild;
trace(root); // Welcome to HBBlog!
rootValue = root.nodeValue;
trace(rootValue); // Welcome to HBBlog!
trace(root == rootValue) // false
}
};
txt_xml.load("txt.xml");

从检测root==rootValue为输出为false看到root和rootValue其实是不相同的. 他们之间的区别,就我现在认为,不使用nodeValue,xml就会把这个文字节点原模原样的返回给flash.即使其中含有转义字符"&lt;","&gt;"等等..再看下面的代码
// xml code
<?xml version="1.0"?>
<root>
Welcome to &lt;HBBlog&gt;!
</root>
// flash code
var txt_xml:XML = new XML();
txt_xml.ignoreWhite = true;
txt_xml.onLoad = function(success) {
if (success) {
root= txt_xml.firstChild.firstChild;
trace(root); // Welcome to &lt;HBBlog!&gt;
rootValue = root.nodeValue;
trace(rootValue); // Welcome to <HBBlog!>
trace(root == rootValue) // false
}
};
txt_xml.load("txt.xml");

现在明白了吧 :)
用nodeValue就可以识别出包含在xml中的转义字符
文章录入:skyuu    责任编辑:skyuu 
  • 上一篇文章:

  • 下一篇文章:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    发表评论:
    姓名:  评 分: 1分 2分 3分 4分 5分
     
  • 严禁发表危害国家安全、政治、黄色淫秽等内容的评论。
  • 用户需对自己在使用幽幽天空服务过程中的行为承担法律责任。
  • 本站管理员有权保留或删除评论内容。
  • 评论内容只代表机友个人观点,与本网站立场无关。