• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Converting a String Object into a XMLStream

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys

I have a String object containing xml content which I get from a 'Database Column'.I would like to use that xml content in the String as a InputStream or FileInputStream or XMLInputStream to be used by my 'JAX-B Classes'.

String a = "<parentTag>abc</ParentTag>";
Can I convert the above String to an inputStream or other formats??

Is there a way I can accomplish this ?..

Thanks in Advance
Ravi
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try this

String src = "myXML";
javax.xml.transform.stream.StreamSource s = new StreamSource(src)
InputStream in = s.getInputStream();
 
ravi D shankar
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Thanks

But in the API
javax.xml.transform.stream.StreamSource s = new StreamSource(src);
StreamSource takes a URI string rt?
I am not whether it works for a raw xml string??

Ravi
 
reply
    Bookmark Topic Watch Topic
  • New Topic