cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 28724] - FragmentExtractor always returns same fragment
Date Sat, 08 May 2004 19:24:53 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28724>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28724

FragmentExtractor always returns same fragment





------- Additional Comments From sarah.windler@id.ethz.ch  2004-05-08 19:24 -------
To 4: proposal a new class:
import org.apache.cocoon.util.HashUtil;
import org.apache.cocoon.xml.SaxBuffer;

FragmentCacheUtil  {
    private XMLReader _reader;
    private HashUtil _util = new HashUtil();
    private SaxBuffer _buf = SaxBuffer();
   FragmentCacheUtil()  {
      try {
       _reader = XMLReaderFactory.createXMLReader();
      } catch (SAXException e) {
	    return;
      }
      _reader.setContentHandler(_buf);
   }
   public long hash(InputSource source)  {
     if (source == null) {
	return 0;
     }
     try {
       _reader.parse(source);
     } catch (SAXException se) {
	return 0;
     } catch (IOException ie)  {
	return 0;
     }
     return _util.hash(buf.toString());
  }
}
Just an idea from a novice. I haven't tested it, not sure about the way...
Sarah

Mime
View raw message