Resolve Google Tag Manager XML Error in Blogger : 'The reference to entity l must end with the ';' delimiter.'

I am trying to integrate Google Tag Manager trace code into Blogger, but getting the XML error: The reference to entity "l" must end with the ';' delimiter.

我試著把 Google Tag Manager 的 trace code 整合在 Blogger 內,但出現了 XML error: The reference to entity "l" must end with the ';' delimiter.。

以下是 Google Tag Manager 提供的 trace code

<!-- 20141223 Trace for Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-KJ4PG3"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript><script type='text/javascript'>
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
<!-- End Google Tag Manager -->

Solution 解決方法

After Google, I found an ampersand "&l" which hasn't been escaped properly from trace code. From the DTD (Document Type Definition), it suggests that we might use an entity as 3 parts: "&", "entity name", and ";", namely &l;.
在 Google 後,我發現原來 Google Tag Manager 的 trace code 內的 &l 寫法並未正確的逃脫,以 DTD 的要求來說,一個實體是由三個部份組成:一個和號 (&)、一個實體名稱、以及一個分號 (;),所以 &l 必須寫成 &l;。

But even I used the $l; which comply the regular of DTD, the XML error message still happen. After I change to use "&amp;l", it works.
但我發現即使改用了 DTD 建議的寫法:$l;,還是出現了相同的錯誤。後來我改用了畸型的寫法 &amp;l 竟然就正常了。

Frankly, I really don't know why. It just works.