Two Laptop Bag*
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 Android Security Essentials Live Lessons this week in the Android 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?
I agree. Here's the link:
subject: passing XML as string to parser method.
Similar Threads
JAX-RS : A Way to Serialize String to XML as a Response?
Parsing RSS2.0 feeds using XML Pull Parser
problem parsing xml string using dom parser
Default XML parser: SAX or DOM?
[DOM] - Problem reading xml data inputStream for parsing.