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!!!

  1. No trackbacks yet.