But what if we want to generate CDATA tags?
Sjaiswal, January 17, 2003 - 2:54 pm UTC
I have to enclose a column in CDATA tags for example..
select '<![CDATA[' || L.location_name || ']]>' from L.location
When I use this query in dbms_xmlgen.newContext() The output clob shows as
<Location_Name><![CDATA[Kirchliches Begegnungszentrum Karow ]]></Location_Name>
It should display as
<Location_Name><![CDATA[Kirchliches Begegnungszentrum Karow ]]></Location_Name>
What should be done to get the '<' and '>' characters in this case
January 17, 2003 - 3:53 pm UTC
if you read above -- you'll be doing it yourself.
Think about it -- we cannot do both -- not escape and escape. You want generic and easy - it works as documented. You need specialized and "just for you", you'll be participating a little more.
What if location_name = 'Greatest Place <as far as I know> On Earth'
HTML Tags
Mir, April 19, 2004 - 6:52 pm UTC
Tom,
I have a HTML Form which accepts a research statment (this is formatted HTML) if i store a </textarea> tag in it. It breaks when i want to edit my data. because of the </textarea> tag. How can i avoid this.
----
procedure biopage(
pnid number default null
)
is
--
cursor c_data (pnid number) is
select firstname, lastname, research_statement
from biotable
where bioid = pnid;
--
mv_firstname varchar2(255);
mv_lastname varchar2(255);
mv_stmt varchar2(4000);
--
begin
--
if pnid is not null then
for i in c_data(pnid) loop
mv_firstname := i.firstname;
mv_lastname := i.lastname;
mv_stmt := i.research_statement;
end loop;
end if;
--
htp.htmlopen;
htp.headopen;
htp.title('Bio Page'));
htp.headclose;
htp.bodyopen;
--
htp.p('<form name="bioform" method="post" action="biopagepost">');
--
htp.p('<table border="0" cellspacing="0" cellpadding="2">');
--
htp.p('<tr>');
htp.p('<td colspan="2" align="right">');
htp.p('<input type="submit" value="Submit">');
htp.p('<input type="reset" value="Reset">');
htp.p('<input type="button" value="Close" onclick="window.close()";>');
htp.p('</td>');
htp.p('</tr>');
--
htp.p('<input type=hidden name="bioid" value="'||pnid||'">');
--
htp.p('<tr>');
htp.p('<td class="formlabel">First Name:</td>');
htp.p('<td><input type=text name="pv_fn" value="'||mv_firstname||'"></td>');
htp.p('</tr>');
--
htp.p('<tr>');
htp.p('<td class="formlabel">Last Name:</td>');
htp.p('<td><input type=text name="pv_ln" value="'||mv_lastname||'"></td>');
htp.p('</tr>');
--
htp.p('<tr>');
htp.p('<td class="formlabel">Research Statement:</td>');
htp.p('<td><textarea name="pv_descr" rows="3" cols="50" wrap="virtual">'||mv_stmt||'</textarea></td>');
htp.p('</tr>');
--
htp.p('</table>');
--
htp.p('</form>');
--
htp.bodyclose;
htp.htmlclose;
--
end;
-----
April 19, 2004 - 7:40 pm UTC
you want to use htf.escape_sc() on all of the "text" fields that may contain HTML in them.
htp.p('<td><textarea name="pv_descr" rows="3" cols="50"
wrap="virtual">'|| HTF.ESCAPE_SC(mv_stmt) ||'</textarea></td>');
Thank U very much
Mir, April 20, 2004 - 12:43 pm UTC
saved my days of work.