[jdom-interest] Convert an org.w3c.dom.Document to java.io.InputStream
David Parker
dlparker at facstaff.wisc.edu
Tue Oct 3 10:26:44 PDT 2000
Hello,
I'm getting a "org.w3c.dom.Document" from a database and I need to convert
it to "java.io.InputStream"
so that I can create a "org.jdom.Document" with the method
build(java.io.InputStream in).
Is it possible to cast one Document to another?
----------------------------------------------------------------------------
---------------------------------------------------------------------------
// returns a org.w3c.dom.Document
domDoc = student.getClassesDOM(conn, "UGRD");
if (doc != null)
{
try {
// Request document building without validation
org.jdom.input.SAXBuilder builder = new
org.jdom.input.SAXBuilder(false);
org.jdom.Document jDoc =
builder.build(xmlSource); //This builds a document from the supplied
input stream.
// Get the root element
org.jdom.Element root = jDoc.getRootElement();
List allChildren = root.getChildren(); //return all children
} catch (Exception ejdom) {
ejdom.printStackTrace();
}
Sincerely,
David Parker
mailto:david.parker at doit.wisc.edu
Library, Instructional & Retrieval Applications,
DoIT - University of Wisconsin-Madison
1210 West Dayton Street, Madison WI 53706
Phone: 608.265.7829 FAX: 608.265-6453
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20001003/9f4c5948/attachment.htm
More information about the jdom-interest
mailing list