This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes bchitr 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 "bchitr" Watch "bchitr" New topic


b panigrahy

Joined: Apr 11, 2006
Posts: 14

I am parsing an XML file against a XSD with Apache XERCES parser.
I am using a FileReader object to pass it to the PARSE method of XERCES parser and after it finishes parsing, it's closing the STREAM of FILEREADER.

But, I would not like to close the STREAM as I would use the same READER further in the code.

Pleae, suggest me.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19720

What would be the point of that? Surely the place you are reading from contains an XML document and nothing else? Which would mean there's nothing else to read from that Reader.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12999
Trying to re-use a Reader is false economy.

Instead, reuse the File object that represents to source file.

I agree. Here's the link:
subject: bchitr
It's not a secret anymore!