Forum Stats

  • 3,767,981 Users
  • 2,252,736 Discussions
  • 7,874,399 Comments

Discussions

Oracle 21 XE Windows nested HTF calls replace special charachters

YuriAP
YuriAP Member Posts: 44 Blue Ribbon

ANCHOR call provides some wellformed HTML tag

But if to nest it into HEADER call, it gets broken

select
HTF.ANCHOR (curl=>'',ctext=>'Table of contents',cname=>'tblofcont',cattributes=>'class="awr"') anc
from dual;
select
HTF.header (2,cheader=>HTF.ANCHOR (curl=>'',ctext=>'Table of contents',cname=>'tblofcont',cattributes=>'class="awr"'),cattributes=>'class="awr"') head_anc
from dual;


ANC                                              
---------------------------------------------------------------------------------------------
<a name="tblofcont"> Table of contents </a>

HEAD_ANC                                           
---------------------------------------------------------------------------------------------
<h2 class="awr">&lt;a name=&quot;tblofcont&quot;&gt; Table of contents &lt;&#x2F;a&gt;</h2>


Is there any way to fix it somehow?

Best Answer

  • User_H3J7U
    User_H3J7U Member Posts: 632 Silver Trophy
    Accepted Answer

    it can be fixed in some more global way

    set_html_escaping_mode, but you need to manually escape ALL passed values in ALL consecutive calls.

    exec htf.set_html_escaping_mode('N')
    select HTF.header (2,cheader=>HTF.ANCHOR (curl=>'',ctext=>htf.escape_sc('Table of <contents>'),
                                  cname=>htf.escape_sc('tblofcont'),
                                  cattributes=>'class="awr"'),
                       cattributes=>'class="awr"') head_anc
    from dual;
    
    HEAD_ANC                                                                
    ------------------------------------------------------------------------
    <h2 class="awr"><a name="tblofcont"> Table of &lt;contents&gt; </a></h2>
    

Answers

  • User_H3J7U
    User_H3J7U Member Posts: 632 Silver Trophy
    replace(.... cheader=> '*<uniqstr>*' ..., '*<uniqstr>*', htf.anchor(...))
    


  • YuriAP
    YuriAP Member Posts: 44 Blue Ribbon

    Thank you, of course, replace is an option, but maybe it can be fixed in some more global way, not involving code change...

  • User_H3J7U
    User_H3J7U Member Posts: 632 Silver Trophy
    Accepted Answer

    it can be fixed in some more global way

    set_html_escaping_mode, but you need to manually escape ALL passed values in ALL consecutive calls.

    exec htf.set_html_escaping_mode('N')
    select HTF.header (2,cheader=>HTF.ANCHOR (curl=>'',ctext=>htf.escape_sc('Table of <contents>'),
                                  cname=>htf.escape_sc('tblofcont'),
                                  cattributes=>'class="awr"'),
                       cattributes=>'class="awr"') head_anc
    from dual;
    
    HEAD_ANC                                                                
    ------------------------------------------------------------------------
    <h2 class="awr"><a name="tblofcont"> Table of &lt;contents&gt; </a></h2>
    
  • YuriAP
    YuriAP Member Posts: 44 Blue Ribbon