jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Guggisberg <stefan.guggisb...@gmail.com>
Subject Re: differentiating elements and attributes in CND
Date Thu, 05 Mar 2009 09:30:49 GMT
hi cris

On Thu, Mar 5, 2009 at 3:48 AM, Cris Daniluk <cris.daniluk@gmail.com> wrote:
> I apologize if this is a question that has been asked and answered, but it
> was difficult to identify in perusing docs/archives. I'm trying to import a
> legacy XML format that utilizes elements where attributes should be used.
> Rather than map it to a new format for storage in Jackrabbit, I'd like to
> keep the existing format so that users are able to XQuery as expected.
> However, when I use the following CND:
> [recordType] > nt:base, mix:referenceable
>  orderable
>  - shouldBeAnAttr (string) mandatory
> [records]
>  - record (recordType) = recordType multiple
> I cannot import the following XML:
> <records>
>  <record><shouldBeAnAttr>ShouldBeTheValueOfAnAttr</shouldBeAnAttr></record>
> </records>
> It isn't a huge shock that it doesn't work with the CND notation. However, I
> can't figure out what the notation *should* be. I've played around with
> various options with the + (child) notation, but I can't get it to roll up
> the CDATA into a value. Is there a way to do this? Do I need a custom
> NodeType?

no, custom node types won't buy you anything here. xml elements will
always be imported as jcr nodes, xml attributes will be imported as jcr
properties. for more information please see
"6.4.2 Document View XML Mapping" in the jsr 170 spec.

while you could write your own importer, based on the jackrabbit
implementation, i wouldn't advise it.

it's probably better if you transform your xml (i.e. make those
elements attrubutes) before importing it. i am not an xml crack
but i guess it should be relatively easy by using xslt.


> More importantly, what do others do when trying to import XML like this into
> JackRabbit? Since it is all validating against the DTD before submission to
> the repository, would it be better off to just leave the recordType as
> nt:unstructured?
> Thanks for your input!
> Cris

View raw message