Re: [xwiki-users] How to get real content of wiki page in plugin Api?

2008-11-04 Thread ladar

Thank you again, you are right. It was problem with the recursive call. 


-- 
View this message in context: 
http://n2.nabble.com/How-to-get-%22real%22-content-of-wiki-page-in-plugin-Api--tp1320740p1455729.html
Sent from the XWiki- Users mailing list archive at Nabble.com.

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] How to get real content of wiki page in plugin Api?

2008-11-02 Thread ladar

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
-- 
View this message in context: 
http://n2.nabble.com/How-to-get-%22real%22-content-of-wiki-page-in-plugin-Api--tp1320740p1446174.html
Sent from the XWiki- Users mailing list archive at Nabble.com.

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] How to get real content of wiki page in plugin Api?

2008-11-02 Thread Sergiu Dumitriu
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@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] How to get real content of wiki page in plugin Api?

2008-10-13 Thread ladar

Thanks, but it is not working. With this method I get hmtl code, but better
than nothing :-) 
-- 
View this message in context: 
http://n2.nabble.com/How-to-get-%22real%22-content-of-wiki-page-in-plugin-Api--tp1320740p1321907.html
Sent from the XWiki- Users mailing list archive at Nabble.com.

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] How to get real content of wiki page in plugin Api?

2008-10-13 Thread Sergiu Dumitriu
ladar wrote:
 Thanks, but it is not working. With this method I get hmtl code, but better
 than nothing :-) 

Try:

$xwiki.parseContent($doc.content)

-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] How to get real content of wiki page in plugin Api?

2008-10-13 Thread Guillaume Lerouge
Hi Vladimir,
do you want to retrieve content from both the page and the attached object
or only content from the attached object?
If you're trying to retrieve content from only the attached object, you can
use something like :

#set($mydoc = $xwiki.getDocument($SpaceName.MyDocument)) ## here you should
input the full name of the document where the object is stored #set($object
= $mydoc.getObject(SpaceName.ObjectClass)) ## in your case this would be 
XWiki.PersonClass
$mydoc.getValue('PropertyName', $object) ## here you should replace
PropertyName with the name (NOT the pretty name) of the property value
you're trying to access.

Hope this helps,
Guillaume

On Sun, Oct 12, 2008 at 10:53 AM, ladar [EMAIL PROTECTED] wrote:


 Thanks, but it is not working. With this method I get hmtl code, but better
 than nothing :-)
 --
 View this message in context:
 http://n2.nabble.com/How-to-get-%22real%22-content-of-wiki-page-in-plugin-Api--tp1320740p1321907.html
 Sent from the XWiki- Users mailing list archive at Nabble.com.

 ___
 users mailing list
 users@xwiki.org
 http://lists.xwiki.org/mailman/listinfo/users




-- 
Guillaume Lerouge
Product Manager - XWiki
Skype ID : wikibc
http://blog.xwiki.com/
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] How to get real content of wiki page in plugin Api?

2008-10-11 Thread Sergiu Dumitriu
ladar wrote:
 Hello,
 I'm trying to work with the content of wiki page in my plugin Api. I can
 access the content through method getContent() called with XWikiDocument.
 However I have an object added to the page and I'm using 
 
 #includeForm(XWiki.PersonClassSheet)
 
 and this is the problem, because with method getContent() I get literally
 #includeForm(XWiki.PersonClassSheet)... 
 Is there any way to get exactly what I see on the page? For example instead
 of 
 
 #includeForm(XWiki.PersonClassSheet) 
 
 I want to see John Smith (or whatever I will define in the ClassSheet)?

Try XWikiDocument.getRenderedContent(XWikiContext).

-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users