Skip to main content
Known Participant
October 19, 2009
Question

Custom Tags: TextImporter not very friendly

  • October 19, 2009
  • 1 reply
  • 2861 views

It seems to me that a very powerful aspect of TLF is the ability to loop through an XML tree and apply custom styling based on your own logic (via IFormatResolver). What I find disappointing is TextConverter's inflexibility and lack of direct TextField-style HTML/StyleSheet support. The docs say that TLF supports the same HTML tags as TextField via TextConverter.HTML_FORMAT. This may be true but it does not support them in the same manner. For example, TextField allows me to create a tag called <whatever> and have a corresponding style in a stylesheet. TextField also allows me to have an <a> be a child of a <span>.  TLF is very anal about what tags can be where and what attributes they can have. In order for me to fully leverage IFormatResolver, I should be able to apply styles based on my own tag names and tag attributes.

When calling ITextImporter.importToFlow, where is the validation occuring? Is there an XSD? Can I override this validation? The strictness causes much pain when dealing with user-input as the source.

I wish TLF was more lenient when importing and would let me decide what to do with "bad" tags and attributes.

This topic has been closed for replies.

1 reply

Known Participant
October 21, 2009

Hello all - Is there no hope here? Do I need to rip apart TLF and invent my own importer?

Adobe Employee
October 21, 2009

Its not clear which importer you are trying to use.  Work is underway in the HTML importer to support custom tags.  Note that because the HTML importer supports the TextField flavor of HTML which is non-standard we are now calling it "textFieldHTMLFormat".

The  TEXT_LAYOUT_FORMAT markup importer doesn't support custom tags - you can accomplish the same thing by preprocessing the markup and making the elements a span with a styleName.  TLF spans are not the same as HTML spans.  In HTML a span is a grouping element.  TLF spans are more akin to HTML text nodes.  We have logged a request for a grouping element similar to an HTML span but are not implementing it at this stage of the development cycle.  Implementing the grouping behavior of span (and links as children of spans) is going to be difficult without that grouping element and will require more work.

If you need to build a custom importer for your particular markup definition go for it.  You should be able to write your own importer - other folks are.  Hopefully the TLF importers can be of some help.  I'd recommend not calling it  "textLayoutFormat" but giving it some name of your own choice.  This can be done without modyfing TLF itself so you can still continue to use the public RSLs etc.

Hope that helps,

Richard

Known Participant
October 21, 2009

I am using the HTML_FORMAT importer.

Work is underway in the HTML importer to support custom tags

Is this work available in SVN yet?

Implementing the grouping behavior of span (and links as children of spans) is going to be difficult without that grouping element and will require more work.

That's too bad - this is the main thing I find very restricting. Looks like I'm going to give a stab at a customer importer.

Thanks for your help Richard,

Matt