Home > flex > The entity name must immediately follow the ‘&’ in the entity reference

The entity name must immediately follow the ‘&’ in the entity reference

If you’ve ever written code in a binding tag and gotten a special character error try html-encoding the character like you’d do if you were encoding regular text:

Error:

<mx:TextInput text="{(_feed.url && !_feed.isTemporary)?_feed.url:'Save Feed to generate URL'}" />

Works:

<mx:TextInput text="{(_feed.url &amp;&amp; !_feed.isTemporary)?_feed.url:'Save Feed to generate URL'}" />

It makes sense after the fact but before you actually do it, it just looks odd to html-encode your actionscript.

Categories: flex Tags:
  1. December 22nd, 2008 at 14:53 | #1

    Thanks for this :)
    It was odd indeed.

  2. December 31st, 2008 at 12:44 | #2

    To fix this keep the code external and wrap it in:

    <![CDATA[

    ]]>

  3. Ahmad
    January 20th, 2009 at 07:46 | #3

    Thanks for the tip. I really didn’t think it will work but it did

  4. Arun BS
    April 6th, 2009 at 07:05 | #4

    Worked like a charm.. thanks..

  5. April 15th, 2009 at 14:59 | #5

    zupper!!!

  6. kevin
    April 23rd, 2009 at 05:07 | #6

    Thanks! It also works with binding…

    enabled=”{Boolean(someValue) && Boolean(someOtherVal)}”

  7. kevin
    April 23rd, 2009 at 05:09 | #7

    Bugger – code got converted – replace the &’s with the & amp; ‘s

  8. June 22nd, 2009 at 19:01 | #8

    Thanks. You save me.

  9. Dude
    July 10th, 2009 at 12:17 | #9

    Thanks. This saved me a bunch of hacking around.

  10. Thanya
    August 14th, 2009 at 13:55 | #10

    Thank you so much for this tip:)
    it really save me time to try the other ways around.

  11. Alok B
    August 23rd, 2009 at 22:52 | #11

    thanks, this worked. Will try out with the CDATA wrap too.

  12. Vidya Rao
    September 2nd, 2009 at 13:25 | #12

    Thank you so much. How did you ever figure that out??!!

  13. Max
    September 7th, 2009 at 23:03 | #13

    you saved my life

  14. November 23rd, 2009 at 06:31 | #14

    Yay thanks ! I really needed this silly thing was driving me nuts ! TANK you :D

  15. oliver
    November 25th, 2009 at 09:16 | #15

    another thank from Germany!

  16. December 11th, 2009 at 00:05 | #16

    G8 , u r my god

  17. Fred
    January 4th, 2010 at 21:31 | #17

    Thanks for your help!!

  18. January 6th, 2010 at 12:02 | #18

    Thanks so much… and Kevin for the binding tip… So helpful!

  19. lili
    January 21st, 2010 at 09:24 | #19

    thank you very much! it bothers me long time!!!

  20. kofi
    May 18th, 2010 at 07:59 | #20

    haha…wow thanks so much !! was driving me NUTS !!

  21. Grateful
    May 29th, 2010 at 02:30 | #21

    Thanks a lot for this – very helpful!

  22. Latha
    June 10th, 2010 at 09:13 | #22

    Thanks a ton.
    It was very helpful

  23. Admin
    July 3rd, 2010 at 00:25 | #23

    Thnks , Very HelpFul !

  24. ARUMUGAM A.V
    July 7th, 2010 at 23:10 | #24

    Dear Sir,

    I am using NetBeans 6.5.

    Both, javascript statements,

    event.keyCode > 47) && (event.keyCode 47) & & (event.keyCode < 58))

    throws error. Please guide me.

  25. ARUMUGAM A.V
    July 7th, 2010 at 23:12 | #25

    Dear Sir,

    I am using NetBeans 6.5.

    Both, javascript statements,

    if((event.keyCode > 47) && (event.keyCode 47) & & (event.keyCode < 58))

    throw error. Please guide me.

  26. July 29th, 2010 at 04:46 | #26

    That really helped, thanks!

  27. September 22nd, 2010 at 07:51 | #27

    Thanks for this, both techniques work. I used the CDATA wrap as I realised this had been left out of a tag when auto-copying a mxml skin for custom skinning (in my case I was copying the ComboBoxButtonSkin). One to watch out for, could be a due to out-of-date SDKs

  28. veera
    September 24th, 2010 at 05:25 | #28

    use < for
    && for &&

  29. Phil
    October 28th, 2010 at 12:05 | #29

    Ahmad :
    Thanks for the tip. I really didn’t think it will work but it did

    DITTO!!!!!

    Excellent, cheers!!!

  30. December 19th, 2010 at 17:52 | #30

    I experienced this error in Carrot2, is a generic error Java,Flash,etc. when we don’t write properly xml files. My xml included special characters, to fix it i added xmlentities at my script.

  31. increpare
    March 23rd, 2011 at 04:05 | #31

    Ah, thanks for this. Saved me some head-scratching :)

  32. murali
    May 20th, 2011 at 23:40 | #32

    hey! it worked fine! thank u so much

  33. July 19th, 2011 at 00:35 | #33

    Hehe, it actually works:)
    Thanks.
    Big LOL to Adobe;P

  34. August 19th, 2011 at 06:09 | #34

    O my gosh, thank you sooo much!!!

  35. anonymous
    August 26th, 2011 at 03:10 | #35

    nice…. it worked. thanks

  36. sournblue
    November 3rd, 2011 at 07:23 | #36

    Thank you very much! It worked for my SAX parser.
    Saved me from spending even more time on this stupid error :)

  37. tarun
    December 20th, 2011 at 19:10 | #37

    Thanks a lot

  38. Bruno
    January 17th, 2012 at 10:10 | #38

    Thanks a lot!!!

  39. February 6th, 2012 at 20:45 | #39

    i got error
    Your template could not be parsed as it is not well-formed. Please make sure that all XML elements are closed properly.
    XML error message: The entity name must immediately follow the ‘&’ in the entity reference.

    bellow tags i add in to my site please look in to my meta tags & find out problem. please make me fair copy of this content

    (function() { var a=window;function c(b){this.t={};this.tick=function(b,i,d){d=void 0!=d?d:(new Date).getTime();this.t[b]=[d,i]};this.tick(“start”,null,b)}var f=new c;a.jstiming={Timer:c,load:f};try{var g=null;a.chrome&&a.chrome.csi&&(g=Math.floor(a.chrome.csi().pageT));null==g&&a.gtbExternal&&(g=a.gtbExternal.pageT());null==g&&a.external&&(g=a.external.pageT);g&&(a.jstiming.pt=g)}catch(h){};a.tickAboveFold=function(b){var e=0;if(b.offsetParent){do e+=b.offsetTop;while(b=b.offsetParent)}b=e;750>=b&&a.jstiming.load.tick(“aft”)};var j=!1;function k(){j||(j=!0,a.jstiming.load.tick(“firstScrollTime”))}a.addEventListener?a.addEventListener(“scroll”,k,!1):a.attachEvent(“onscroll”,k);
    })();

  40. February 6th, 2012 at 20:47 | #40

    (function() { var a=window;function c(b){this.t={};this.tick=function(b,i,d){d=void 0!=d?d:(new Date).getTime();this.t[b]=[d,i]};this.tick(“start”,null,b)}var f=new c;a.jstiming={Timer:c,load:f};try{var g=null;a.chrome&&a.chrome.csi&&(g=Math.floor(a.chrome.csi().pageT));null==g&&a.gtbExternal&&(g=a.gtbExternal.pageT());null==g&&a.external&&(g=a.external.pageT);g&&(a.jstiming.pt=g)}catch(h){};a.tickAboveFold=function(b){var e=0;if(b.offsetParent){do e+=b.offsetTop;while(b=b.offsetParent)}b=e;750>=b&&a.jstiming.load.tick(“aft”)};var j=!1;function k(){j||(j=!0,a.jstiming.load.tick(“firstScrollTime”))}a.addEventListener?a.addEventListener(“scroll”,k,!1):a.attachEvent(“onscroll”,k);
    })();

  41. ashi
    February 23rd, 2012 at 17:20 | #41

    Thanks that really helped

  42. kasun
    March 3rd, 2012 at 06:27 | #42

    @Satellaview
    Yes this is most suitable way as it makes clear almost all the sp chars.

  43. Tiago Wanke Marques
    March 23rd, 2012 at 05:14 | #43

    Thanks!

  44. unnathi
    April 23rd, 2012 at 22:00 | #44

    Thanks

  1. February 2nd, 2012 at 01:48 | #1