I think one can easily convrt a string to input stream using InputStream is = new ByteArrayInputStream( aString.toBytes() ); Any comments? Is this a good/efficient way? Bruce
BJ - SCJP and SCWCD
We love Java programming. It is contagious, very cool, and lot of fun. - Peter Coad, Java Design
Efficient - yes. Good - possibly not. The parse(InputSource is) method, as suggested by David Kane, is preferable as it handles character-encoding conversions automagically. StringReader reader = new StringReader(aString); InputSource inputSource = new InputSource(); inputSource.setCharacterStream(reader); docBuilder.parse(inputSource); David ---- peterson_d_s@hotmail.com
L Goundalkar
Ranch Hand
Joined: Jul 05, 2001
Posts: 395
posted
0
Hi all, Thanks a lot. ------------------ L Goundalkar lggoundalkar@hotmail.com Sun Certified Programmer for Java 2 Platform
If any of you have tried sending XMLEncoded beans as http request contents, you will have noticed that when you try to decode, javax.servlet.HttpRequest.getInputStream() includes the CRLF line break at the beginning of the content.