Hi vincent, Thanks a lot. I have been through the mailing list. Am working on the plan and architecture. Will mail you once done.
On Tue, May 19, 2009 at 1:13 PM, Vincent Massol <[email protected]> wrote: > Hi Arun, > > You should definitely not use this script. > Your first task if you haven't done it yet should be to understand the > XWiki Rendering module. > See http://code.xwiki.org/xwiki/bin/view/Modules/RenderingModule > > For other details already discussed see > http://markmail.org/thread/pd2e5utudps3buwx > > Thanks > -Vincent > > On May 18, 2009, at 8:11 PM, Arun Reddy wrote: > > > Hi, > > > > I have a small doubt on how listener is implemented in > > MediaWiki2XWikiExtension > > > > Groovy Code Snippet -- > > http://code.xwiki.org/xwiki/bin/view/Extensions/MediaWiki2XWikiExtension > > > > <% > > import org.dom4j.io.SAXReader > > import org.dom4j.* > > import groovy.net.xmlrpc.* > > import java.net.ServerSocket > > import org.wikimodel.wem.mediawiki.MediaWikiParser > > import org.wikimodel.wem.xwiki.* > > > > class PruningPageHandler implements ElementHandler { > > def proxy, token; > > def counter = 0; > > def max = 10000; > > > > PruningPageHandler(proxy, token) { > > this.proxy = proxy > > this.token = token > > } > > def messages = [] > > > > > > public void onStart(ElementPath path) { } > > public void onEnd(ElementPath path) { > > > > def page = path.current > > def title = page.elementText('title') > > title = title.replaceAll(' ','_') > > def id = page.elementText('id') > > > > println(title+ '('+counter+')') > > def revision = page.element('revision') > > def revid = revision.elementText('id'); > > def revtext = revision.elementText('text'); > > def contributor = revision.element('contributor') > > def username = contributor.elementText('username') > > > > def index = revtext.substring(0, > > Math.min(30,revtext.length())).toLowerCase().indexOf("redirect") > > > > counter++; > > if (counter < max && index < 0) { > > > > revtext = revtext.replaceFirst("^-", "*"); > > revtext = revtext.replaceAll("__","") > > revtext = revtext.replaceAll("[\\|][\\+]","") > > def buffer = new StringBuffer() > > buffer.append(revtext) > > try { > > > > *def reader = new StringReader(revtext); > > def parser = new MediaWikiParser(); > > buffer = new StringBuffer() > > def listener = new XWikiSerializer(buffer); > > parser.parse(reader, listener);* > > > > } catch (Exception e) { > > println(e.getMessage()) > > } > > def map = new HashMap() > > map.put('content', buffer.toString()) > > map.put('modifier', username) > > map.put('space','Wikipedia') > > map.put('title',title) > > try { > > proxy.confluence1.storePage(token, map) > > } catch (Exception e) { > > println(e.getMessage()) > > } > > } > > page.detach() // prune the tree > > } > > } > > %> > > > > > > > > XWikiSerializer has a constructor with some class implementing > > IWikiPrinter > > . But how come a StringBuffer is used here. > > > > Am trying to simulate the same from a java application,and a fact > > that use > > of StringBuffer fails here. How to create a listener object in that > > case. > > > > > > Thanks and Best Regards, > > Arun Reddy > > _______________________________________________ > > devs mailing list > > [email protected] > > http://lists.xwiki.org/mailman/listinfo/devs > > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs > -- Best Regards, Arun Reddy _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

