Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Can I load a xml string versus reading a file  RSS feed

 
Ray Smilgius
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • 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).]
 
James Swan
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!