Home » Developer & Programmer » JDeveloper, Java & XML » XML Output help (Oracle 10g)
XML Output help [message #352245] Mon, 06 October 2008 18:19 Go to next message
Anthrax
Messages: 8
Registered: June 2006
Junior Member
Hi

i have now got my database to output relational data as XML using this procedure.
CREATE OR REPLACE PROCEDURE xml_resources (file_dir varchar2,file_name varchar2) IS
BEGIN
DECLARE
  queryCtx DBMS_XMLquery.ctxType;
  result CLOB;

BEGIN

  queryCtx := DBMS_XMLQuery.newContext('select * from RESOURCES ORDER BY R_ID');
  result := DBMS_XMLQuery.getXML(queryCtx);
  DBMS_XMLQuery.closeContext(queryCtx);



--call another procedure to write the clob into a file in batches
clob_to_file(file_dir,file_name||'.xml',result);
END;

END xml_resources;


and that gets sent to the clob_to_file procedure to be written to hard disk in .xml format.

the problem i have now is that i need to style it with XSLT but i need to some how put the link to the stylesheet at the top of the xml document.

is there any way to do this?
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="xml.xsl"?>


oracle just puts the first one in and not the second line

[Updated on: Mon, 06 October 2008 18:21]

Report message to a moderator

Re: XML Output help [message #352288 is a reply to message #352245] Mon, 06 October 2008 23:48 Go to previous messageGo to next message
rajatratewal
Messages: 507
Registered: March 2008
Location: INDIA
Senior Member
Chk This Out

DBMS_XMLQuery.setStylesheetHeader(v_ctx, 'C:\Development\XML\IEStyle.xsl', 'text/xsl');


Regards,
Rajat Ratewal

[Updated on: Mon, 06 October 2008 23:50]

Report message to a moderator

Re: XML Output help [message #352352 is a reply to message #352245] Tue, 07 October 2008 04:48 Go to previous messageGo to next message
Anthrax
Messages: 8
Registered: June 2006
Junior Member
sweet thanks alot for that one Smile
Re: XML Output help [message #352462 is a reply to message #352245] Tue, 07 October 2008 18:38 Go to previous messageGo to next message
Anthrax
Messages: 8
Registered: June 2006
Junior Member
hi there again.

is it possible to get oracle to output an Encoding Standard?

like <?xml version="1.0" encoding="ISO-8859-1"?>
at the moment my database is only putting the version at the top of the page and its causing some encoding issues when displaying the content.

mine looks like <?xml version="1.0"?>

i looked around for something like DBMS_XMLQuery.setEncoding() but couldnt find anything that resembled that.

Thanks
Re: XML Output help [message #352470 is a reply to message #352462] Tue, 07 October 2008 21:45 Go to previous messageGo to next message
rajatratewal
Messages: 507
Registered: March 2008
Location: INDIA
Senior Member
Actually i am not an XML expert.But I know how google works.

You should /forum/fa/456/0/ first.

I found following things./forum/fa/1964/0/


Quote:

If the XML data is obtained from a CLOB or VARCHAR value, then the encoding declaration is ignored, because these two data types are always encoded in the database character set.

XMLTYPE has something of your interest.

INSERT INTO mytable2 VALUES (XMLType(bfilename('XMLDIR', 'purchaseOrder.xml'),nls_charset_id('AL32UTF8')));





So search google for more.

Regards,
Rajat Ratewal




Re: XML Output help [message #352656 is a reply to message #352470] Wed, 08 October 2008 18:53 Go to previous message
Anthrax
Messages: 8
Registered: June 2006
Junior Member
thanks for your help.

just so you know i spent ages trying to find a solution, clearing your keywords were better than mine
Previous Topic: XML and XSL in a table, how to get to HTML?
Next Topic: XML parsing in pl/sql
Goto Forum:
  


Current Time: Tue Dec 17 22:27:49 CST 2024