Quantcast
Channel: SCN : Blog List - SAP CRM: Webclient UI - Framework
Viewing all articles
Browse latest Browse all 195

Converting HTML to XHTML using CL_HTMLTIDY

$
0
0

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.

 

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

Example:

  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'

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.

    I will enhance this blog by a step by step manual as soon as possible. Pass the UFT8-XSTRING as Import data.

 

Regards,

Daniel


Viewing all articles
Browse latest Browse all 195

Trending Articles