For some projects or applications one may need XHTML-data instead of HTML. In some cases you may need XHTML to parse data to Adobe Forms for example.

The process roughly is the following:

html as String –> convert to UTF8 Xstring –> Convert with tidy –> transform with XSLT –> pass to Adobe forms Base64

I will describe this process step-by-step

One idea to convert the data is based on the Tidy library, which was originally developed by Dave Reggett (HTML Tidy Project Page)

It’s also possible to use this library within the ABAP stack by instrument the class CL_HTMLTIDY.

Here I describe roughly the way to do that:

1. First you have to convert the HTML to UTF8-XSTRING e.g. with help of the class cl_abap_conv_out_ce or  cl_gstext_tools


  lv_text_as_xstring = cl_gstext_tools=>convert_string_to_xstring( iv_string  =  lv_html ).

2. Create a global obkject  from CL_HTMLTIDY-object: cl_htmltidy=>create( ).

3. Set the options for the Tidy-object by using the method set-option from the class. The parameter input encoding has to be ‘utf8’

  gr_htmltidy->set_optionEXPORTING option  = ‘inputencoding’

                                      value   = ‘utf8’).

You can also set the values for output-encoding and char-encoding in the same way (also to utf8)

You can also have a look at this german blog: Rüdiger Plantiko: Testbare Oberflächen

4. Use the instance (object) of the CL_HTMLTIDY-class to trigger the method to convert. Have a look at the available methods in SE24.

   CALL METHOD gr_htmltidy->repair


       input       = xstring_input

       diagnostics = ‘X’


       output      = xstring_output

       retcode     = lv_retcode

       errors      = lv_errors.

5. Unfortunately some tags (e.g. <strong>) are not replaced (e.g. by XHTML-standard <b>). For that you have to use XSLT.

The use of XSLT is also depending on the current Adobe Forms version you use. Check which XFA-specification is supported and have a look at the offical specifications by Adobe and which TAGs are supported.

An XSLT-conversion to replace <strong>-tags by <b>-tags may look like that:

<xsl:transform version=“1.0”




<xsl:output encoding=“UTF-8” method=“xhtml” indent=“yes” standalone=“0” version=“1.0”/>

<xsl:strip-space elements=“*”/>

  <xsl:template match=“@*|node()”>


     <xsl:apply-templates select=“@*|node()”/>



  <xsl:template match=“/”>



<xsl:template match=“x:strong”>


      <xsl:apply-templates select=“@*|node()”/>




6. Use Base64 encoding to prepare the data for Adobe Forms output.


If you have any further questions to this process, just write a comment or open a discussion thread and link me.



To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Joby Thomas


    I am facing the problem to display the text in adobeform from webdynpro component ‘Formatted textedit’ element as the html tags are coming with the text

    i am able to show the bold i.e <b>sample</b> as a rich text in the adobform

    But in the above scenario text from webdynpro is coming with the tag <strong>sample text</strong>  so please suggest how to handle this

    currently we are using adobecycle designer 10

    i read in SCN that we need to set data format to XHTML but I am not finding that option 🙁

    From webgui the user is storing data as below


    But in the table level the data is storing as below

    <ol><li><h1>sample text 1</h1></li><li><h1><p>sample text 2</p></h1></li></ol>

    I want to display the as shown in above image in my adobeform, please suggest how to handle




      I am also facing the same problem.

      Please confirm it can be achieved or not ? i tried the way mentioned above and it shows now the hexadecimal code of the string.

      Please suggest

  2. Daniel Kehne Post author

    @Karthik, you have to convert the Hexdecimal String with a standard encoder class back to the coding you need. (e.g. cl_abap_conv_in_ce)

    @Joby: If you want to bring <strong> to <b> tag you can use this code snippet here within your XSL Transformation file

    <xsl:template match=“x:strong”>


          <xsl:apply-templates select=“@*|node()”/>




Leave a Reply