Dear all,
I'm trying to extend a FAQ application from the tutorial on xwiki site.
I would like to add some FAQ entries from the external file in an automated or
semi-automated way.
In the FAQ example there are: question, answer fields for every FAQ entry. Is it possible
to add new entries
basing on the external data user provided ?
like to take a data from a text area in a form like:
"question1", "answer1"
"question2", "answer2"
and then create 2 new FAQ objects ?
I've found such a code snippet and fixed it to have:
## Create an object
#set($obj = $doc.newObject("FAQ.FAQClass"))
$obj.set("question","q1")
$obj.set("answer", "a1")
## Save the object in the page
$doc.save()
Even with that it fails to add new object to the existing list. Any clues how to
accomplish that ?
Just to recap, I have two questions :
1. Could someone provide a code snippet, or point me to a documentation on creating/adding
new objects in
the xwiki ( like how to set parentSpace, basic fields in that object and add it to the
xwiki database ).
2. Are there any scenarios on importing data in to the XWiki ( would like to inject a lot
of FAQ entries at
once, tried to do that directly to the database but that failed, I guess I should do that
via velocity code ? ).
Thanks a lot for any help :)
Regards,
Piotr