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: Importing XML using IMPORT_UUID_COLLISION_REPLACE_EXISTING
Date Wed, 25 Oct 2006 08:51:26 GMT
hi pete,

On 10/24/06, pdog <pete.mazur@connectyourcare.com> wrote:
>
>
> Jukka Zitting-3 wrote:
> >
> > Hi,
> >
> > On 10/24/06, pdog <pete.mazur@connectyourcare.com> wrote:
> >> I am trying to import an xml file into an existing repository.  Just
> >> trying
> >> to get a simple example working but when I import the xml it doesn't
> >> overwrite the node that I am trying to replace, but it creates a new node
> >> of
> >> the same name in the path specified.
> >
> > Note that the node you are trying to replace needs to be
> > referenceable. You can check whether this is true by looking for a
> > "jcr:uuid" attribute of the root element of the exported XML document.
> >
> > If needed, you can make the node referenceable like this:
> >
> >
> > session.getRootNode().getNode("menu/privacypolicy").addMixin("mix:referenceable");
> >     session.save();
> >
> > BR,
> >
> > Jukka Zitting
> >
> >
>
> Thanks for the respone Jukka.  I added on the mix:referenceable to the nodes
> and when I import the XML now it overwrites the node which is the action I
> was hoping for.  I do notice now that if I export the XML it does have the
> jcr:uuid in the XML but it doesn't have the mixin property there.
>
> Here is the steps I am taking:
>
> 1.  Create a node with .addMixin("mix:referenceable") for that node and any
> node above it (so the root in my example)
> 2.  Export the node to XML.  This XML has the jcr:uuid in it but does not
> have the jcr:mixinTypes in it.
> 3.  Now import the XML into the repository node.  The node that is updated
> now doesn't have the jcr:mixinTypes that were there before b/c it wasn't in
> the XML.
> 4.  Now if I export the node to XML it doesn't have the jcr:uuid in it.
>
> Is this the normal behavior for the export?  If so then I will just add the
> mixin after the import that I do, but I thought I would ask before hand
> anyways if I was doing something odd or could do something to get the
> mixinTypes into the xml.

you're using document view export. note that document view is not guaranteed
to fully roundtrip as some information is lost in the docuemtn view
xml mapping,
see 6.4 XML Mappings in the jsr 170 specification.

to answer you're question: this behaviour is not normal in a sense that you
wouldn't expect it but it is in accordance with the specification.

if you need to import previously exported content you should use
system view export, i.e. Session.exportSystemView().

cheers
stefan

>
> Thanks
> --
> View this message in context: http://www.nabble.com/Importing-XML-using-IMPORT_UUID_COLLISION_REPLACE_EXISTING-tf2501558.html#a6975007
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>
>

Mime
View raw message