Ok, I think I've finally figured it out. I create a wrapper around the DefaultContentHandler class called MyImportContentHandler, and then do this: ContentHandler ch = session.getImportContentHandler(...); new MyImportContentHandler(ch).parase(input stream);
On Feb 12, 2008 11:38 AM, Sridhar Raman <[EMAIL PROTECTED]> wrote: > Oh ok, I got it (I hope). > Currently, I perform an import by doing a session.importXML(...) in my > class. Instead, I should do this right? > ContentHandler ch = session.getImportContentHandler(...); > MyImportHandler mih = (MyImportHandler) ch; > mih.parse(input stream); > > > On Feb 12, 2008 11:24 AM, Sridhar Raman <[EMAIL PROTECTED]> wrote: > > > But how would I be able to wrap the content handler without modifying > > the AbstractSession class? Is there some API I can use to set the content > > handler, in which case I wouldn't need to alter any of the Jackrabbit code. > > > > > > On Feb 8, 2008 6:49 PM, Marcel Reutegger <[EMAIL PROTECTED]> > > wrote: > > > > > Hi Sridhar, > > > > > > Sridhar Raman wrote: > > > > In the class AbstractSession, the method importXML has this line: > > > > ContentHandler handler = > > > > getImportContentHandler(parentAbsPath, uuidBehavior); > > > > I am supposed to wrap this ContentHandler object right? > > > > > > correct. but you don't have to change any of the jackrabbit code. > > > simply wrap > > > the content handler that is returned. > > > > > > > Currently it's returning ImportHandler object. I need to write a > > > similar > > > > handler, where I take care of the 1000 node count in the endElement > > > method. > > > > Am I on the right track? > > > > > > yes, something similar to: > > > > > > https://svn.apache.org/repos/asf/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/DefaultContentHandler.java > > > > > > then keep track on nodes that are added through start/endElement(). > > > > > > regards > > > marcel > > > > > > > >
