Path: news.easynews.com!newsfeed1.easynews.com!easynews.com!easynews!newsfeed-east.nntpserver.com!nntpserver.com!skynet.be!skynet.be!news.tele.dk!news.tele.dk!small.news.tele.dk!news-ge.switch.ch!news.grnet.gr!not-for-mail
From: "Sofia" <list@oytis.com>
Newsgroups: comp.databases.oracle.misc
Subject: XML-encoding
Date: Thu, 12 Dec 2002 17:43:45 +0200
Organization: GRNET, Greece
Lines: 55
Message-ID: <ataasv$jgk$1@nic.grnet.gr>
NNTP-Posting-Host: 195.251.2.152
X-Trace: nic.grnet.gr 1039707871 19988 195.251.2.152 (12 Dec 2002 15:44:31 GMT)
X-Complaints-To: abuse@grnet.gr
NNTP-Posting-Date: Thu, 12 Dec 2002 15:44:31 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Xref: newsfeed1.easynews.com comp.databases.oracle.misc:90471
X-Received-Date: Thu, 12 Dec 2002 08:44:08 MST (news.easynews.com)

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




