12 Replies Latest reply on Mar 24, 2008 11:27 AM by ntsiii

    Embedding inline HTML data in XML using the <mx:XML> tag with < and >

    rollingsj
      What is best practice for embedding HTML within the <mx:XML> tag? Programmatically, I can implement this successfully:

      [Bindable]
      public var xmlDP:XML = <component data="&lt;" />;

      However, I get the following error if I try to store the same data inline in an mx:XML tag, as such:

      <mx:XML id="xmlDP">
      <component data="&lt;" />
      </mx:XML>

      Error #1095: XML parser failure: Unterminated attribute.

      If I change the MXML tag as follows, it works fine:

      <mx:XML id="xmlDP">
      <component data="&amp;lt;" />
      </mx:XML>

      Unfortunately, I also can not source the mx:XML tag to an XML file which uses &lt; or &gt; codes, as it yields the same results. This leads me to believe that the <mx:XML> tag does not support the special character codes for < and >, but why?

      Incidentally, this code also gives a 1095 error:

      <mx:XML id="xmlDP">
      <component data="&#0060;" />
      </mx:XML>

      This is causing an issue with my source data as it is not hand typed into Flex, and standard XML supports the &lt; and &gt; codes. I have tried a full HTML string, as shown below, but this also generates the error:

      <mx:XML id="xmlDP">
      <component data="&lt;b&gt;Test&lt;/b&gt;" />
      </mx:XML>

      Many thanks for any input you may have!