• Post Reply Bookmark Topic Watch Topic
  • New Topic

Transform XML blob object from database to PDF  RSS feed

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need some help in one of my requirements. I have a xml file stored as Blob object in the Oracle database. My requirement is to connect to the database, get the xml file, parse the xml file and output the content of the xml to a pdf. My pdf should be of specific format. Can any one help me with any ideas in this context please? I appreciate if someone can provide me with some sample code.

Thanks,
Ram...
 
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What part do you need help with? There are a number of different phases to your process, each of which requires different tools.
 
Rama Krishna Ghanta
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know I should use an XML parser to parse the xml and I should use itext to output to a pdf. I have written the jdbc connection code also. I stopped at Blob blob = resultSet.getBlob("blobObject").I don't know how to proceed next.

Thanks,
Ram...
 
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need to convert that Blob to valid XML, have a look for conversion routines and/or look at bringing it back as something other than a Blob (perhaps generically as an Object).

Once you have the XML you can start using the iText libs...
 
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems to me if that Blob was created by somebody writing the text of an XML document into a Blob and storing it you should be able to use the Blob getBinaryStream method to get an InputStream.

If that InputStream can be read as valid characters you should be able to parse it.

If the format of the xml is suitable you might be able to do an XSL transform directly on that stream to get FOP formatted output suitable for feeding to a PDF creation tool.

On the other hand, if that Blob is - for example - a serialized Java object, you have other problems.

Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!