Copy one TextArea content into another XWiki Syntax Only


I am very new to xwiki and I can see all the power of this tool.
But it’s pretty hard to understand at first.

Here my problem.
I try to copy, in velocity, a TextArea content to another in an object.
Here my code :

  $doc.set("answer", "${question}  ${answer}")

That seems to work fine.

But when I open the “question” field, I can see both html and xwiki syntax.

How can I copy only the wiki syntax ?

Thank you for your help.

Hi, that’s because our API is not well designed :wink: $doc.get(...) returns the HTML.

What you want is: doc.getValue('question')

See also

That works.

Unfortunately, The Scripting API Guide is pretty silent about the getValue function.
I finally looked at the code, and the difference is clear.

Thank you @vmassol for your great help.

I’ve just added some javadoc for these methods: [Misc] Add missing javadoc · xwiki/xwiki-platform@93aa589 · GitHub

It’s strange as I was pretty sure we had some, but apparently not.