Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XMLSerialize indent end of line marker

paul zipAug 1 2013 — edited Aug 12 2013

In 11g you can specify to pretty print XML when serializing using the indent clause of XMLSerialize.  The trouble is this is formatted using the UNIX end of line marker, Line Feed = #10, even if Oracle is running under Window Server (windows uses Carriage Return + Line Feed = #13#10).  This is causing problems when XML docs are delivered to users on Windows machines, who open it in notepad or similar - it means the data isn't visualised properly (not pretty printed) and they see the LF as a "box" character, which confuses them.

declare

  vFileContents CLOB;

  vXMLData XMLType;

begin

...

  select XMLSerialize(document vXMLData as CLOB indent)

  into vFileContents

  from dual;

...

  -- Code to output vFileContents to file.

end;

/

Is there any setting (session or DB) to specify CRLF as the default end of line marker, rather than having to do a search and replace on every document?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 9 2013
Added on Aug 1 2013
3 comments
1,150 views