1 Reply Latest reply on Jun 29, 2011 1:25 AM by Masteradi

    Text Layout Framework: custom tags > custom FlowElement

    Masteradi Level 1

      Hello everybody reading this,

       

      Okay, the TextConverter.importToFlow() and TextConverter.export() methods do understand some tags like <a>, <p>, <span>, etc. But is it possible to define custom tags (elements) and let the TextConverter.importToFlow() and TextConverter.export() methods understand/interpret these custom tags?

       

      For example, say I have the following String which I would like to transform into a TextFlow instance.

      var input:String = '<TextFlow whiteSpaceCollapse="preserve" version="2.0.0" 
      xmlns="http://ns.adobe.com/textLayout/2008"><p><span>Hello </span>
      <span fontWeight="bold">World</span><span>.</span></p><custom title="custom title">This is in custom</custom>
      </TextFlow>';

       

      As you can see at the end of the String, there is a tag <custom> with one attribute "title" and with CDATA content. Now if I let the TextConverter convert this String into a TextFlow, the whole <custom>-tag gets removed. How can I create a new CustomElement class (like for example a SpanElement class) and then inform the Importer about that class and its corresponding tag? Of course the same should work in the opposite direction. So assume I have a CustomElement, I would like to generate a <custom> tag on exporting the TextFlow.

       

      Any ideas? Work arounds? Suggestions?

       

      Thank you already.