• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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
 
What are you doing in my house? Get 'em tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic