Skip to main content
Known Participant
November 25, 2009
Answered

HtmlImporter handles <span> incorrectly

  • November 25, 2009
  • 1 reply
  • 603 views

I have got a simple test case as following:

<html>
<body>

<p>
     <span>
          <em>this is emphsize</em>
          <a href="http://cnn.com">link to cnn</a>
          and one line of text
     </span>     
</p>

</body>
</html>

Seems TextConverter.importToFlow() can't handle the nested span tag correctly, all text in <em> and <a> are removed, just the last line ("and one line of text") survived.

The same html will display alright in both safari and firefox (on mac) which made me think this is probably a importer bug ? looks like TextFlow doesn't like nested stuff within a single span tag ?

any idea ? thanks.

This topic has been closed for replies.
Correct answer robin_briggs

Note the

<i>this is italic<i>

in the example you posted. Did you mean <i>this is italic</i>? If I make this change, I get the result you expected.

- robin

1 reply

Adobe Employee
November 30, 2009

This looks like a bug that was fixed. It looks better to me in the more recent TLF. Can you get the latest textLayout.SWF and try it out again?

Thanks,

- robin

ASHandlerAuthor
Known Participant
December 1, 2009

hi Robin,

Thanks for replying.

I just updated to the latest textLayout.swc and give following text a try:

var k:String = "<html><body><span>first line of text, <i>this is italic<i> and <a href='cnn.com'>a link to cnn</a>, 2nd line of text.</span></body></html>";

and this is what I got after import it to textFlow then dump it:

  <TextFlow columnCount="inherit" columnGap="inherit" columnWidth="inherit" lineBreak="inherit" paddingBottom="inherit" paddingLeft="inherit" paddingRight="inherit" paddingTop="inherit" verticalAlign="inherit" whiteSpaceCollapse="preserve" xmlns="http://ns.adobe.com/textLayout/2008">
  <p>
    <span>first line of text,</span>
    <span fontStyle="italic">this is italic and</span>
    <a fontStyle="italic" href="cnn.com" target="_self">
      <span>a link to cnn</span>
    </a>
    <span fontStyle="italic">, 2nd line of text.</span>
  </p>
</TextFlow>

please note the 3rd and 4th lines shouldn't be in italic, seems it inherited the italic style from the preceding line, which is not correct.

robin_briggsCorrect answer
Adobe Employee
December 1, 2009

Note the

<i>this is italic<i>

in the example you posted. Did you mean <i>this is italic</i>? If I make this change, I get the result you expected.

- robin