Re: [問題] xmlns:aaa="Main"
※ 引述《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="" rel="nofollow">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
→
08/25 17:44,
08/25 17:44
推
08/26 04:16,
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)
→
08/27 14:51, , 1F
08/27 14:51, 1F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 2 之 4 篇):