Hi,
I am trying to remove the whitespace from an XML Clob that I create from a SQL query. This is to shrink the file size to be compatible with our messaging software.
I wrote a small script below, using the xmlParser.setPreserveWhitespace setting, but it simply copies the XML exactly.
Any ideas why the whitespace is not being removed?
Thanks,
Paul
I am trying to remove the whitespace from an XML Clob that I create from a SQL query. This is to shrink the file size to be compatible with our messaging software.
I wrote a small script below, using the xmlParser.setPreserveWhitespace setting, but it simply copies the XML exactly.
Any ideas why the whitespace is not being removed?
Thanks,
Paul
Code:
declare
parser_ xmlparser.parser;
doc_ xmldom.domdocument;
node_ xmldom.domnode;
real_clob_ clob;
out_clob_ clob;
begin
parser_ := xmlparser.newparser;
xmlparser.setpreservewhitespace(parser_, false);
dbms_lob.createtemporary(real_clob_, true, dbms_lob.session);
dbms_lob.copy(real_clob_, :in_message_, dbms_lob.getlength(:in_message_));
-- read file and store it as dom-document in clob:
xmlparser.parseclob(parser_, real_clob_);
doc_ := xmlparser.getdocument(parser_);
xmlparser.freeparser(parser_);
dbms_lob.createtemporary(out_clob_, true, dbms_lob.session);
xmldom.writetoclob(doc_, out_clob_);
:out_message_ := out_clob_;
end;