• 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

Can I load a xml string versus reading a file

 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to use the response read from a servlet and use that xml string
see code
DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();

DocumentBuilder db=dbf.newDocumentBuilder();

Document doc=db.parse("C:xmljar/employee.xml"); //I need to use a xml string instead of file any ideas

NodeList idNl=doc.getElementsByTagName("id");

NodeList nameNl=doc.getElementsByTagName("name");
now it works with using a employee.xml file but I need to use a string returned by a response in a servlet. I can't seem to find an API for this
example
String content ="<InScopeLogin><UserName>"+user+"</UserName><Password>"+password+"</Password></InScopeLogin>"

Then
Document doc=db.parse(content);//instead of file

Thanks Ray Smilgius
------------------
Sun Certified Java Programmer
Sun Certified Java Developer
I-Net Certified
A+ Certified
Network+ Certified
MCP
[This message has been edited by Ray Smilgius (edited November 08, 2001).]
[This message has been edited by Ray Smilgius (edited November 08, 2001).]
 
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This thread should solve it for you.
http://www.javaranch.com/ubb/Forum31/HTML/001425.html
James.
 
Ray Smilgius
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks that did the trick
Ray
------------------
Sun Certified Java Programmer
Sun Certified Java Developer
I-Net Certified
A+ Certified
Network+ Certified
MCP
reply
    Bookmark Topic Watch Topic
  • New Topic