jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: Getting "filenotfound" exception in importing an xml file using JCR API
Date Fri, 24 Apr 2009 11:44:24 GMT
On Fri, Apr 24, 2009 at 11:52 AM, astra123 <sandhya.jayachandran@tcs.com> wrote:
>
> When im trying to import an xml file usinf JCR API following the code
>
>
> File inputFile = new File("view.xml");
>            in = new FileInputStream(inputFile);
>            session.importXML("/", in,
> ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
>            session.save();
>
> Im getting file not found exception.
>
> Where do i need to place the XML file (with in IDE or? anywhere)
> How to specify the path in this code.
> Noraml xml format can be imported or do i need to need to change anything in
> XML format.

The first question is more a basic Java API question... but anyway: If
you use new File("view.xml"), it will look for the file in the current
working directory of your java program. If that might be difficult,
I'd suggest to use an absolute path for the beginning, eg.
"/home/foo/view.xml".

Regarding the XML import: JCR can import files in "document" and
"system", whereas document view allows any normal XML file (system
view is a specific JCR XML format including JCR metadata). Have a look
at the JCR spec for this, section 6.4.2 (see [1] or [2])

[1] http://jcp.org/en/jsr/detail?id=170
[2] http://www.day.com/specs/jcr/1.0/

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Mime
View raw message