In my quest to write a java server that parses XML, do something, write the
result on the very same socket I have come across to a few problems.
In my previous mail I did congratulate dom4j for its excellent job and
exmplained a few tricks I have come across.
I was suggesting a simple patch to avoid closing the inputStream on
SAXDriver parser termination, but there is a "cleaner" solution.
Just write a class like this.
class NocloseReader extends BufferedReader
{
public NocloseReader(InputStreamReader dataIn ) { super ( dataIn ); }
public void close () { /* System.out.println ("Not Closing"); */ }
}
and the use it as this.
public void parse ( InputStream dataIn ) throws IOException,SAXException
{
InputStreamReader inReader = new InputStreamReader ( dataIn );
NocloseReader inNoclose = new NocloseReader (inReader);
InputSource inSource = new InputSource (inNoclose);
saxParser.parse( inSource );
}
A neat solution I come across in my wandenring in the net, maybe you also
find it useful.
Damiano Bolla, Director R&D, Infotech S.r.l
-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
dom4j-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-dev