Bonjour j'ai developpe ce bout de code qui me cree un format xml:
try
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
DOMImplementation impl = builder.getDOMImplementation();

Element el = null;
Node n_date = null;
Node n_datetxt = null;
Node n_topstory = null;
Node n_topstorytxt = null;
Node n_summary = null;
Node n_summarytxt = null;
Node n_detail = null;
Node n_detailtxt = null;
// Document.
xmldoc = impl.createDocument(null, "latestevents", null);
// Root element.
Element root = xmldoc.getDocumentElement();
el= xmldoc.createElementNS(null,"newshead");
/**
* <date> ... </date>
*/
n_date = xmldoc.createElement("date");
n_datetxt = xmldoc.createTextNode(dateXmlFormat);
n_date.appendChild(n_datetxt);
el.appendChild(n_date);

/**
* <topstory> ... </topstory>
*/
n_topstory = xmldoc.createElement("topstory");
n_topstorytxt = xmldoc.createTextNode(TopStryXmlFormat);
n_topstory.appendChild(n_topstorytxt);
el.appendChild(n_topstory);

/**
* <summary> ... </summary>
*/
n_summary = xmldoc.createElement("summary");
n_summarytxt = xmldoc.createTextNode(SummXmlFormat);
n_summary.appendChild(n_summarytxt);
el.appendChild(n_summary);

/**
* <details> ... </details>
*/
n_detail = xmldoc.createElement("details");
n_detailtxt = xmldoc.createTextNode(DetailXmlFormat);
n_detail.appendChild(n_detailtxt);
el.appendChild(n_detail);



root.appendChild(el);
DOMSource domSource = new DOMSource(xmldoc);
StringWriter sw = new StringWriter();
Result streamResult = new StreamResult(sw);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer serializer = tf.newTransformer();
serializer.setOutputProperty(OutputKeys.ENCODING,"ISO-8859-1");
serializer.setOutputProperty(OutputKeys.INDENT,"yes");
serializer.transform(domSource, streamResult);

//afficher(sw.toString());


FileInputStream instreamXml = new FileInputStream(sw.toString());

File monxmlfll = new File("C://update.xml");
FileOutputStream ostreamImage = new FileOutputStream(monxmlfll);

File eventimg1 = new File("C://events_pictures/event2.jpg");
FileInputStream istreamImage1 = new FileInputStream(eventimg1);

byte[] buffer = new byte[1024];
int length = 0;

while((length = instreamXml.read(buffer)) != -1)
{


ostreamImage.write(buffer, 0, length);

}
try
{
ps.setInt(1, 9);
ps.setString(2,"13-MAY-2007");
ps.setBinaryStream(3, instreamXml, 2048); /** xml blob contains the latest news events **/
ps.setBinaryStream(4, istreamImage1, (int) eventimg1.length()); /** pictures correspoding to the each event **/
//ps.setBinaryStream(4, istreamImage2, (int) eventimg2.length()); /** pictures correspoding to the each event **/

ps.executeUpdate();
}
catch(Exception exx)
{
afficher("ERRORb: "+exx);
}
finally
{
instreamXml.close();
}



}catch(Exception exc){}
Je voudrai savoir comment le transformer ensuite en input stream car j'ai besoin de le suavegarder dans la base de donnee oracle comme etant un BLOB (document xml)
J'ai fait cela mais ca ne marche pas:
FileInputStream instreamXml = new FileInputStream(sw.toString());