What is the format of attachments in XAR?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

What is the format of attachments in XAR?

xrichard
This post was updated on .
Hi,

I'm trying to retrieve attachments stored in a XAR export file.

According to documentation (see http://extensions.xwiki.org/xwiki/bin/view/Extension/XAR+Module+Specifications) XML node <attachment> contains everything I need to get files content but how it's encoded and how to decode the sub-node <content>  ?

Thanks for your answers, best regards,
Reply | Threaded
Open this post in threaded view
|

Re: What is the format of attachments in XAR?

Jean SIMARD
Hi,

It's a Base64 encoding so you should be able to use on Linux any base64
decoder.  For example, on Linux (I guess on Mac it must be similar), you
can do

cat your-content.txt | base64 -d

or shorter

base64 -d your-content.txt

I hope this helps,

Sincerely,

On 27/04/2016 08:33, xrichard wrote:

> Hi,
>
> I'm trying to retrieve attachments stored in a XAR export file.
>
> According to documentation (see
> http://extensions.xwiki.org/xwiki/bin/view/Extension/XAR+Module+Specifications)
> XML node <attachment> contains everything I need to get files content but
> how is encoded and how to decode the node <content>  ?
>
> Thanks for your answers, best regards,
>
>
>
> --
> View this message in context: http://xwiki.475771.n2.nabble.com/What-is-the-format-of-attachments-in-XAR-tp7599233.html
> Sent from the XWiki- Users mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/users
>

--
Jean Simard
[hidden email]
Research engineer at XWiki SAS
http://www.xwiki.com
Committer on the XWiki.org project
http://www.xwiki.org
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: What is the format of attachments in XAR?

Thomas Mortagne
Administrator
I just added more details about the attachment on
http://extensions.xwiki.org/xwiki/bin/view/Extension/XAR+Module+Specifications.

That being said if you are in Java one way to not have to care about
that is to use the XWiki Filter module to parse the XAR since you
don't need a running instance of XWiki to use it.

You can see what the standard XAR parser does with attachments on
https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-filter/xwiki-platform-filter-streams/xwiki-platform-filter-stream-xar/src/main/java/org/xwiki/filter/xar/internal/input/AttachmentReader.java#L79.

On Wed, Apr 27, 2016 at 9:57 AM, Jean SIMARD <[hidden email]> wrote:

> Hi,
>
> It's a Base64 encoding so you should be able to use on Linux any base64
> decoder.  For example, on Linux (I guess on Mac it must be similar), you
> can do
>
> cat your-content.txt | base64 -d
>
> or shorter
>
> base64 -d your-content.txt
>
> I hope this helps,
>
> Sincerely,
>
> On 27/04/2016 08:33, xrichard wrote:
>> Hi,
>>
>> I'm trying to retrieve attachments stored in a XAR export file.
>>
>> According to documentation (see
>> http://extensions.xwiki.org/xwiki/bin/view/Extension/XAR+Module+Specifications)
>> XML node <attachment> contains everything I need to get files content but
>> how is encoded and how to decode the node <content>  ?
>>
>> Thanks for your answers, best regards,
>>
>>
>>
>> --
>> View this message in context: http://xwiki.475771.n2.nabble.com/What-is-the-format-of-attachments-in-XAR-tp7599233.html
>> Sent from the XWiki- Users mailing list archive at Nabble.com.
>> _______________________________________________
>> users mailing list
>> [hidden email]
>> http://lists.xwiki.org/mailman/listinfo/users
>>
>
> --
> Jean Simard
> [hidden email]
> Research engineer at XWiki SAS
> http://www.xwiki.com
> Committer on the XWiki.org project
> http://www.xwiki.org
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/users



--
Thomas Mortagne
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: What is the format of attachments in XAR?

xrichard
Thanks for your answers and documentation update, I'm now able to decode attachments stored in XAR file.