Skip to main content
Known Participant
April 19, 2010
Question

custom HTML importer/exporter, how to preserve HTML id, class, style

  • April 19, 2010
  • 1 reply
  • 628 views

I need to implement a custom XHTML importer/exporter and CSSFormatResolver.

If I for example have a p-element: <p id="p1" class="xyz" style="margin:0.7em; color:#3300FF">lorem ipsum</p>

How do I map the HTML attributes: id, class and style in order to preserve them in the ParagraphElement in order to use them during the custom CSS cascade process and for custom HTML export purposes (the exporter needs to spit out <p id="p1" class="xyz" style="margin:0.7em;  color:#3300FF">lorem ipsum</p> again.

1. is this mapping correct or will this interfere with internal TLF formatting:

HTML attributeParagraphElement property
idid
classstyleName
styleuserStyles

2. What is the purpose of FlowElement.coreStyles (where are those styles applied)?

3. What is the actual purpose of FlowElement.userStyles, are those styles just for non TLF (end developer custom) purposes or does TLF use them at any point to set the element format properties?

4. Any other pointers or related (non flex framwork) examples are welcome

Thanks.

Cheers, Benny

This topic has been closed for replies.

1 reply

Adobe Employee
April 20, 2010

Your mapping looks correct to me for id and styleName.

I think what you are saying about style mapping to userStyles is correct.  Yes userStyles is an object of key value pairs holding all the non-TLF styles for a FlowElement.  coreStyles holds all the TLF styles for a FlowElement. TLF does use userStyles itself for the linkHoverFormat, linkActiveFormat and linkNormalFormat styles.

Setting FlowElement.userStyles TLF will replace the current set of userStyles with those in the supplied Object.  That Object will be treated as a dictionary of stylenames and values.

Normally I'd expect you'd use the FlowElement.setStyle API which figures out if a particular style belongs to coreStyles or userStyles and then sets the new style appropriately without changing the others.

Richard