You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Karianne Berg <ke...@start.no> on 2008/05/27 01:51:49 UTC

Get XML back in its original form

Hello list,

I use Jackrabbit mainly to store XML data, and use the session.importXML(...) and session.exportDocumentView(...) to get my XML in and out of the repository. However, when I export my XML data using exportDocumentView, all the XML tags have the attribute jcr:primaryType="nt:unstructured". Is there any way to export the XML without the extra attributes, or do I have to run an XSLT transformation that removes them after I've exported the XML?

Best regards,
Karianne Berg


RE: Get XML back in its original form

Posted by Karianne Berg <ke...@start.no>.
> > When I work with XML data that is not tied up to JCR in any way,
> > I would like to get the same thing out as I put in.

> If you need to store XML documents as-is (as opposed to an abstract
> content model that's just serialized to XML), then I would recommend
> storing the XML as a binary property, preferably inside a
> nt:file/nt:resource structure.

OK, then I'll do that. Thank you for your help!

Best regards,
Karianne Berg


Re: Get XML back in its original form

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Tue, May 27, 2008 at 1:14 PM, Karianne Berg <ke...@start.no> wrote:
> Thank you for your reply. Is there a particular reason why this is not possible?

A JCR content repository like Jackrabbit is not an XML database.

> When I work with XML data that is not tied up to JCR in any way,
> I would like to get the same thing out as I put in.

If you need to store XML documents as-is (as opposed to an abstract
content model that's just serialized to XML), then I would recommend
storing the XML as a binary property, preferably inside a
nt:file/nt:resource structure.

BR,

Jukka Zitting

RE: Get XML back in its original form

Posted by Karianne Berg <ke...@start.no>.
Hello,

Thank you for your reply. Is there a particular reason why this is not possible? When I work with XML data that is not tied up to JCR in any way, I would like to get the same thing out as I put in.

Best regards,
Karianne Berg

-----Original Message-----
From: Alexander Klimetschek [mailto:aklimets@day.com] 
Sent: Tuesday, May 27, 2008 11:22 AM
To: users@jackrabbit.apache.org
Subject: Re: Get XML back in its original form

Hi,

there is no way to tell the API to exclude the jcr:primaryType
attribute. Apart from using an XSLT transformation, you could also
write a ContentHandler that wraps another one (the one you are using
now) and overwrite the startElement() method to exclude the
jcr:primaryType attribute.

Regards,
Alex

On Tue, May 27, 2008 at 1:51 AM, Karianne Berg <ke...@start.no> wrote:
> Hello list,
>
> I use Jackrabbit mainly to store XML data, and use the session.importXML(...) and session.exportDocumentView(...) to get my XML in and out of the repository. However, when I export my XML data using exportDocumentView, all the XML tags have the attribute jcr:primaryType="nt:unstructured". Is there any way to export the XML without the extra attributes, or do I have to run an XSLT transformation that removes them after I've exported the XML?
>
> Best regards,
> Karianne Berg
>
>



-- 
Alexander Klimetschek
alexander.klimetschek@day.com

>> Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/ <<

----------------------------< alexander.klimetschek@day.com >----------
Alexander Klimetschek, Day Management AG, Barfuesserplatz 6,
CH - 4001 Basel, T +41 61 226 55 31, M +49 151 15 77 20 56
---------------------------------------< http://www.day.com >-----------------

Xing: http://www.xing.com/go/invite/3268380.32d2d4
LinkedIn: http://www.linkedin.com/in/klimetschek
Blog: http://weblogs.goshaky.com/weblogs/alexkli/


Re: Get XML back in its original form

Posted by Alexander Klimetschek <ak...@day.com>.
Hi,

there is no way to tell the API to exclude the jcr:primaryType
attribute. Apart from using an XSLT transformation, you could also
write a ContentHandler that wraps another one (the one you are using
now) and overwrite the startElement() method to exclude the
jcr:primaryType attribute.

Regards,
Alex

On Tue, May 27, 2008 at 1:51 AM, Karianne Berg <ke...@start.no> wrote:
> Hello list,
>
> I use Jackrabbit mainly to store XML data, and use the session.importXML(...) and session.exportDocumentView(...) to get my XML in and out of the repository. However, when I export my XML data using exportDocumentView, all the XML tags have the attribute jcr:primaryType="nt:unstructured". Is there any way to export the XML without the extra attributes, or do I have to run an XSLT transformation that removes them after I've exported the XML?
>
> Best regards,
> Karianne Berg
>
>



-- 
Alexander Klimetschek
alexander.klimetschek@day.com

>> Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/ <<

----------------------------< alexander.klimetschek@day.com >----------
Alexander Klimetschek, Day Management AG, Barfuesserplatz 6,
CH - 4001 Basel, T +41 61 226 55 31, M +49 151 15 77 20 56
---------------------------------------< http://www.day.com >-----------------

Xing: http://www.xing.com/go/invite/3268380.32d2d4
LinkedIn: http://www.linkedin.com/in/klimetschek
Blog: http://weblogs.goshaky.com/weblogs/alexkli/