File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes passing  XML  as string to parser method. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "passing  XML  as string to parser method." Watch "passing  XML  as string to parser method." New topic

passing XML as string to parser method.

Pooja Agarwal
Ranch Hand

Joined: May 19, 2004
Posts: 37
Hai All

I have got a small problem here.
I am getting an XML file as a string from Java client to my sevlet.
I need to parse the string. But SAX parser takes URI as input and not string directly. It also has an overloaded method which takes Inputsource as an input. (i.e it can take a character stream, a byte stream).
Let me know if there is a way to convert String to character stream, or a byte stream) OR any other way to parse the string directly.

Any help regarding this would be appreciated.
Thanks in advance
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
How about a StringReader?
Consider Paul's rocket mass heater.
subject: passing XML as string to parser method.