| Author |
Can I load a xml string versus reading a file
|
Ray Smilgius
Ranch Hand
Joined: Jan 29, 2001
Posts: 120
|
|
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).]
|
SCJO, SCJD, SCWCD, I-Net+, A+, Network+, MCSD, MCDBA, MCP, MCT
|
 |
James Swan
Ranch Hand
Joined: Jun 26, 2001
Posts: 403
|
|
This thread should solve it for you. http://www.javaranch.com/ubb/Forum31/HTML/001425.html James.
|
 |
Ray Smilgius
Ranch Hand
Joined: Jan 29, 2001
Posts: 120
|
|
Thanks that did the trick Ray ------------------ Sun Certified Java Programmer Sun Certified Java Developer I-Net Certified A+ Certified Network+ Certified MCP
|
 |
 |
|
|
subject: Can I load a xml string versus reading a file
|
|
|