[xwiki-users] Uploading five XWiki documents ?
Hello, for some reasons I am missing a few documents in my xwiki instance and would like to upload them from source. But I can't seem to find a way to upload the XML files, only XARs (and don't know how to pack a xar yet). I know I could view the XML, unescape the needed part, and paste into the web but that's very awkward. thanks in advance paul
On Jan 14, 2008, at 4:02 PM, Paul Libbrecht wrote:
Hello,
for some reasons I am missing a few documents in my xwiki instance and would like to upload them from source. But I can't seem to find a way to upload the XML files, only XARs (and don't know how to pack a xar yet).
I know I could view the XML, unescape the needed part, and paste into the web but that's very awkward.
Right now we don't any UI to do what you want so I see only 2 possibilities: 1) create the XAR. It's simply a Zip with a package.xml file. Check an existing xar for the format of that file. You could also use our maven xar plugin but that's probably going to take longer. 2) write some velocity script, such as (not tested): #set ($tmpDoc = $xwiki.createDocument()) #set ($newdoc = $tmpDoc.getDocument().fromXml(string or inputstream) $newdoc.save() You'll get the xml string or input stream by attaching the xml source to a page and with something like: $attachmentpage.getAttachment("attachment name").getContentAsString() Note that you'll need programming rights for this. -Vincent
Paul, When you get this working it would be nice to post it as a code snippet on http://code.xwiki.org or even send a patch to modify the import page so that it can import xwiki xml pages. Thanks -Vincent On Jan 14, 2008, at 4:30 PM, Vincent Massol wrote:
On Jan 14, 2008, at 4:02 PM, Paul Libbrecht wrote:
Hello,
for some reasons I am missing a few documents in my xwiki instance and would like to upload them from source. But I can't seem to find a way to upload the XML files, only XARs (and don't know how to pack a xar yet).
I know I could view the XML, unescape the needed part, and paste into the web but that's very awkward.
Right now we don't any UI to do what you want so I see only 2 possibilities:
1) create the XAR. It's simply a Zip with a package.xml file. Check an existing xar for the format of that file. You could also use our maven xar plugin but that's probably going to take longer. 2) write some velocity script, such as (not tested):
#set ($tmpDoc = $xwiki.createDocument()) #set ($newdoc = $tmpDoc.getDocument().fromXml(string or inputstream) $newdoc.save()
You'll get the xml string or input stream by attaching the xml source to a page and with something like: $attachmentpage.getAttachment("attachment name").getContentAsString()
Note that you'll need programming rights for this.
-Vincent
participants (2)
-
Paul Libbrecht -
Vincent Massol