Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> XML-encoding

XML-encoding

From: Sofia <list_at_oytis.com>
Date: Thu, 12 Dec 2002 17:43:45 +0200
Message-ID: <ataasv$jgk$1@nic.grnet.gr>


Dear friends, I was wondering if you could help me.

I am using sys_xmlgen to get xml

--> from an Oracle 9i db which has an ISO-8859-7 encoding

--> to a java class (running in the Jdeveloper local oc4j)

Whilst parsing the XML in my java class, an 'invalid UTF encoding' exception rises from the parser.

It seems as if the parser is quite certain the text is in UTF format. How could I possibly explicitly define the output to be in ISO-8859-7?

I am attaching an extract from my code. Any ideas much welcomed.

Sofia

----------snip,snip--8X-----------------------------------------------



// Load Oracle driver
DriverManager.registerDriver (new oracle.jdbc.OracleDriver());

// Connect to the local database (using OCI or thin driver) Connection conn =
DriverManager.getConnection("jdbc:oracle:thin:@buble:1521:corfu", "scott", "tiger" );

PreparedStatement ps = conn.prepareStatement("select p.doc.getclobval() s from v_trim p where p.trimhno=1 and p.kodikos_mis=60620 and etos=2005"); ResultSet rs = ps.executeQuery();

InputStreamReader to_return = null;
rs.next();
to_return = new InputStreamReader(rs.getAsciiStream("s"), "ISO-8859-7" );

rs.close();
ps.close();

int xml_sch = 0;
StringBuffer sBuf = new StringBuffer();
while( (xml_sch = to_return.read( )) != -1 ) sBuf.append( (char)xml_sch );

InputStream i_s = new StringBufferInputStream(sBuf.toString()); DOMParser par = new DOMParser();
InputSource is = new InputSource( i_s ); is.setEncoding("ISO-8859-7");
par.parse( is ); <---- problem arises here Received on Thu Dec 12 2002 - 09:43:45 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US