aspose file tools*
The moose likes XML and Related Technologies and the fly likes Can I load a xml string versus reading a file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Can I load a xml string versus reading a file" Watch "Can I load a xml string versus reading a file" New topic
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can I load a xml string versus reading a file
 
Similar Threads
Java Web Services 2
trouble passing info from servlet to jsp
Passing Document from servlet to JSP see code
need to get response xml string back from servlet to jsp page
A parsing challenge I am stuck