Re: [問題] xmlns:aaa="Main"

看板Flash作者 (紅虫)時間13年前 (2010/08/26 17:58), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串2/4 (看更多)
※ 引述《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,
你的 code 我執行,不會有你說的 aaa
08/25 17:44

08/26 04:16,
根本看不出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)

08/27 14:51, , 1F
先前為快速測試,故使用Flash CS4直接貼 code 執行
08/27 14:51, 1F
文章代碼(AID): #1CTZh5sS (Flash)
文章代碼(AID): #1CTZh5sS (Flash)