You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by "GOODWIN, MATTHEW (ATTCORP)" <mg...@att.com> on 2011/03/18 16:10:55 UTC
Validate nodes on workspace.importXML
When importing nodes from an xml file using Workspace.importXML is it
possible to validate/reject a node? For example say we want to reject
(i.e. don't import) the nodes that have a department property that has a
value of accounting?
Thanks,
Matt
Re: Validate nodes on workspace.importXML
Posted by David Buchmann <da...@liip.ch>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
hi matt,
if you use Workspace.importXML, things are persisted immediately. if you
need this (i.e. for performance) you could pre-process your xml to
validate the content. you could run some xslt over it that filters out
what you do not want to import.
or you could use the Session.importXML that does not persist the
changes, use JCR methods to walk through your tree and remove any nodes
you do not want, or fix them, and then do a Session.save()
http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0/javax/jcr/Session.html#importXML%28java.lang.String,%20java.io.InputStream,%20int%29
hope this helps,
david
Am 18.03.2011 16:10, schrieb GOODWIN, MATTHEW (ATTCORP):
> When importing nodes from an xml file using Workspace.importXML is it
> possible to validate/reject a node? For example say we want to reject
> (i.e. don't import) the nodes that have a department property that has a
> value of accounting?
>
>
>
> Thanks,
>
>
> Matt
>
>
- --
Liip AG // Agile Web Development // T +41 26 422 25 11
CH-1700 Fribourg // PGP 0xA581808B // www.liip.ch
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk2EeaAACgkQqBnXnqWBgIutmQCgsIeEFIjbkpKJoRoCM+9KS9PT
biwAn2LG3oMUcYa6c7ntxze3Z/Tgwpzo
=pBJ3
-----END PGP SIGNATURE-----