File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes String to XMLType Conversion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "String to XMLType Conversion" Watch "String to XMLType Conversion" New topic

String to XMLType Conversion

Dibyendu Sarkar

Joined: Jan 12, 2009
Posts: 25
Hi everyone... I hope everyone's doing good.

I've run into an issue with XMLType. Here's the problem:

I have an XML stored in a XMLType column in the database. I extracted it from the database, did the parsing, did all the modification and now I have an updated XML string that I need to update back into the column I fetched it from. Now this is where I'm stuck. How can I convert a String containing XML into an XMLType object?

Any ideas?

XMLType has this method:

XMLType.createXML(Connection conn, String xmlString).

I'm trying to use this one. Can anyone tell me how to go about getting the first parameter?
If there is a totally different way to do the String -> XMLType conversion, please let me know that as well.

This is a pure Java app and I'm using iBatis.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 31585

I vaguely remember reading you can use stmt.setAsciiStream() for this. I don't remember where I read it though so I don't know how well supported it is.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
I agree. Here's the link:
subject: String to XMLType Conversion