ladar wrote:
> Hello again,
> I'm still playing with the content of the page and I'm trying to use
>
> $xwiki.parseContent($doc.content)
>
> as Sergiu advised me. On the page I have just simple form with one submit
> button and some text. My plugin is called after submitting the form
> #if($request.Send)
> $xwiki.myPlugin.operate($xwiki.parseContent($doc.content))
> #end
>
> And in the plugin Api I have just this
> public void operate(String source){
> System.out.println(source);
> }
>
> I know this is pretty useless, but it doesn't matter... The output of this
> method is this (line 9 in my source of the page is
> "$xwiki.myPlugin.operate($xwiki.parseContent($doc.content))":
>
> [ERROR] Method parseContent threw exception for reference $xwiki in template
> Main.try at [9,21]
> [ERROR] Method parseContent threw exception for reference $xwiki in template
> Main.try at [9,1]
> org.xwiki.velocity.XWikiVelocityException: Failed to evaluate content with
> id [Main.try]
> at
> org.xwiki.velocity.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:187)
> at
> org.xwiki.velocity.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:143)
> at
> com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:107)
> at
> com.xpn.xwiki.render.XWikiVelocityRenderer.render(XWikiVelocityRenderer.java:84)
> at
> com.xpn.xwiki.render.XWikiVelocityRenderer.interpret(XWikiVelocityRenderer.java:51)
> at
> com.xpn.xwiki.render.DefaultXWikiRenderingEngine.renderText(DefaultXWikiRenderingEngine.java:269)
> at
> com.xpn.xwiki.render.DefaultXWikiRenderingEngine.interpretText(DefaultXWikiRenderingEngine.java:175)
> at com.xpn.xwiki.XWiki.parseContent(XWiki.java:1557)
> at com.xpn.xwiki.api.XWiki.parseContent(XWiki.java:569)
> ...
> ...
> ...
> Caused by: org.apache.velocity.exception.MethodInvocationException:
> Invocation of method 'parseContent' in class com.xpn.xwiki.api.XWiki threw
> exception java.lang.StackOverflowError @ Main.try[9,28]
> ...
> ...
> ...
> Error number 4001 in 4: Error while parsing velocity page Main.try
> Wrapped Exception: Failed to evaluate content with id [Main.try]
> com.xpn.xwiki.XWikiException: Error number 4001 in 4: Error while parsing
> velocity page Main.try
> Wrapped Exception: Failed to evaluate content with id [Main.try]
> ...
> ...
> ...
>
> Instead of "..." there are error messages. And after this there is the
> correct output, but for so many times (at least 50 by estimation). The all
> output has almost 8500 lines :-( Does anyone know what am I doing wrong?
> Thank you
Are you by any chance trying to print the same page that calls the print
method? parseContent executes the velocity code inside the page, so by
trying to parse the content you try to parse the content that tries to
parse the content that tries to parse the content that tries to parse
the content etc.
In other words: recursive call. Try printing the contents of another
document, like:
$xwiki.myPlugin.operate($xwiki.parseContent($xwiki.getDocument('Main.WebHome').content))
hoping that your code was not already in Main.WebHome...
--
Sergiu Dumitriu
http://purl.org/net/sergiu/_______________________________________________
users mailing list
users@...
http://lists.xwiki.org/mailman/listinfo/users