作者l314 (紅虫)
看板Flash
標題[問題] xmlns:aaa="Main"
時間Mon Aug 23 11:33:46 2010
小弟在試 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
→ ben0209:你的 code 我執行,不會有你說的 aaa 08/25 17:44
推 dsmwang:根本看不出aaa從哪冒出來的= = 08/26 04:16