This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Blob formatted in XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Blob formatted in XML" Watch "Blob formatted in XML" New topic
Author

Blob formatted in XML

vikranth patoju
Greenhorn

Joined: Nov 21, 2007
Posts: 3
Hi,
i wrote a code which gets the blob object from the database and using the bufferedinputstream i read the blob as bytestream.

Blob b = rs.getBlob("TCblob");
String XmlString = "";
BufferedInputStream bis = new BufferedInputStream(b.getBinaryStream());
byte []bt = new byte[50];
XmlString = "<Request><row>" + bt+ "</row></Request>";
System.out.println(XmlString);
processXml(XmlString);

In the method processXMl

NodeList ls1 = doc.getElementsByTagName("row");

String b = ls1.item(0).getFirstChild().getNodeValue();
byte [] bt = b.getBytes();
System.out.println(bt);

problem here is i found both byte arrays are different by printing on the console. So how to get the same data throught parsing the XML??
please reply..
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Blob formatted in XML
 
It's not a secret anymore!