Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove whitespace from XML

Status
Not open for further replies.

birdman5

Programmer
Dec 9, 2002
15
0
0
GB
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

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;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top