permaculture playing cards*
The moose likes XML and Related Technologies and the fly likes is Document object closes the open file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "is Document object closes the open file" Watch "is Document object closes the open file" New topic
Author

is Document object closes the open file

swapnel surade
Ranch Hand

Joined: Mar 05, 2009
Posts: 129
Hi,

I'm using
SAXBuilder xmlFilebuilder = new SAXBuilder();
Document xmlDocument = xmlFilebuilder.build(filePath);

to parse the XML file. But my application requires many hits to XML file.
the app I'm developing is getting one problem as "Too Many open files".
I'm using JDK 6.

I'm not closing the file explicitly as I don't have instance of file. I'm using SAXBuilder.
is Document object closes the object explicitly or not...

thanks
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Well, Im not familiar with JDOM but generally we expect XML parsers to close the input stream no matter where it comes from.

You could always build a java.io.InputStream and use the build( inputstream ) then close the stream explicitly.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: is Document object closes the open file
 
Similar Threads
How do I close an opened XML-file I just read?
need to update entry in XML file.
JDOM parsing and memory
Parser Pooling with JDOM
Reading a xml file