作者l314 (红虫)
看板Flash
标题Re: [问题] xmlns:aaa="Main"
时间Thu Aug 26 17:58:25 2010
※ 引述《l314 (红虫)》之铭言:
小弟在试 Essential Actionscript 3.0 p.403的范例:
var htmlNS:Namespace = new Namespace("html", "
http://www.w3.org/1999/xhtml");
var shopNS:Namespace = new Namespace("shop", "
http://example.com/furniture");
default xml namespace = htmlNS;
var catalog:XML = <html/>;
catalog.addNamespace(shopNS);
catalog.head.title = "Catalog";
catalog.body.shopNS::table = "";
catalog.body.shopNS::table.@shopNS::id = "4875";
catalog.body.shopNS::table.table = "";
catalog.body.shopNS::table.table.@border = "1";
catalog.body.shopNS::table.table.tr.td = "Item";
catalog.body.shopNS::table.table.tr.td[1] = "Price";
trace(catalog.toXMLString());
result:
<html xmlns:shop="
http://example.com/furniture" xmlns="
http://www.w3.org/1999/xhtml">
<head>
<title>Catalog</title>
</head>
<body>
<shop:table shop:id="4875">
<table border="1">
<tr>
<td>Item</td>
<aaa:td xmlns:aaa="Main">Price</aaa:td>
</tr>
</table>
</shop:table>
</body>
</html>
请问版上大大为什麽 上面第二个td 会跑出aaa这个namespace呢?
谢谢..
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 60.251.117.162
1F:→ ben0209:你的 code 我执行,不会有你说的 aaa 08/25 17:44
2F:推 dsmwang:根本看不出aaa从哪冒出来的= = 08/26 04:16
请问邦邦大大是用什麽sdk编译的?
我用flash builder预设的flex 4.1, 以及flex builder 预设的flex 3.1编译,
用flash player debugger 10.1.82.76执行
会出现上面那个奇怪的aaa namespace
不过我若把default xml namespace = htmlNS 这行拿掉..
就不会aaa namespace了,
但是该行会变成<td xmlns="Main">Price</td>
多了xmlns="Main" 这东西..
Main 是我这个class的名字...
我google "xmlns:aaa" "actionscript" 发现有少数人跟我一样有这个问题,
但是没有找到解答..
另外小弟发现, 这样的状况只会出现在有两个以上的同名child时,
一旦用了[] operator, 第二个child就会出现xmlns:"ClassName"
如果设default namesapce, 该xmlns 就会变成 xmlns:aaa
还请版上高手帮忙..
谢谢..
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 60.251.117.162
※ 编辑: l314 来自: 60.251.117.162 (08/26 18:08)
3F:→ ben0209:先前为快速测试,故使用Flash CS4直接贴 code 执行 08/27 14:51