Importing files from local file system

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Importing files from local file system

hendrickst
I can't recall how to do this and am looking for help. I need to import a file from the local system to eXist. The server is a Windows box and the following are the basics.

I'm trying to import a csv (say import.csv) from D:\temp directory to /db/temp collection.

Xmldb:store('/db/temp', 'import.csv', 'D:\temp\import.csv') isn't working. I know my issue is in the third parameter but I don't recall the proper format. Any help is appreciated.


Trevor Hendricks
 (A)bort (R)etry (I)nfluence with large hammer.



------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Importing files from local file system

Joe Wicentowski
Hi Trevor,

This should give you the gist (pun intended):


Joe


On Wed, Jul 23, 2014 at 1:14 PM, Hendricks Trevor <[hidden email]> wrote:
I can't recall how to do this and am looking for help. I need to import a file from the local system to eXist. The server is a Windows box and the following are the basics.

I'm trying to import a csv (say import.csv) from D:\temp directory to /db/temp collection.

Xmldb:store('/db/temp', 'import.csv', 'D:\temp\import.csv') isn't working. I know my issue is in the third parameter but I don't recall the proper format. Any help is appreciated.


Trevor Hendricks
 (A)bort (R)etry (I)nfluence with large hammer.



------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Importing files from local file system

Loren Cahlander
In reply to this post by hendrickst
Xmldb:store('/db/temp', 'import.csv', file:read-binary('D:\temp\import.csv'), 'text/csv')

You will need to run as a DBA user to run a file function.

Sent from my iPad

> On Jul 23, 2014, at 1:14 PM, Hendricks Trevor <[hidden email]> wrote:
>
> I can't recall how to do this and am looking for help. I need to import a file from the local system to eXist. The server is a Windows box and the following are the basics.
>
> I'm trying to import a csv (say import.csv) from D:\temp directory to /db/temp collection.
>
> Xmldb:store('/db/temp', 'import.csv', 'D:\temp\import.csv') isn't working. I know my issue is in the third parameter but I don't recall the proper format. Any help is appreciated.
>
>
> Trevor Hendricks
> (A)bort (R)etry (I)nfluence with large hammer.
>
>
>
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> Exist-open mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/exist-open

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Importing files from local file system

hendrickst
Unfortunately this did not work. I'm getting the following error.

XMLDB reported an exception while storing documentorg.xmldb.api.base.XMLDBException: The XML parser reported a problem: fatal error at (1,1) : Content is not allowed in prolog.

I'm running eXist 1.4.5 currently (upgrading in the next few months) so that may be the problem.

-----Original Message-----
From: Loren Cahlander [mailto:[hidden email]]
Sent: Wednesday, July 23, 2014 2:04 PM
To: Hendricks Trevor
Cc: [hidden email]
Subject: Re: [Exist-open] Importing files from local file system

Xmldb:store('/db/temp', 'import.csv', file:read-binary('D:\temp\import.csv'), 'text/csv')

You will need to run as a DBA user to run a file function.

Sent from my iPad

> On Jul 23, 2014, at 1:14 PM, Hendricks Trevor <[hidden email]> wrote:
>
> I can't recall how to do this and am looking for help. I need to import a file from the local system to eXist. The server is a Windows box and the following are the basics.
>
> I'm trying to import a csv (say import.csv) from D:\temp directory to /db/temp collection.
>
> Xmldb:store('/db/temp', 'import.csv', 'D:\temp\import.csv') isn't working. I know my issue is in the third parameter but I don't recall the proper format. Any help is appreciated.
>
>
> Trevor Hendricks
> (A)bort (R)etry (I)nfluence with large hammer.
>
>
>
> ----------------------------------------------------------------------
> -------- Want fast and easy access to all the code in your enterprise?
> Index and search up to 200,000 lines of code with a free copy of Black
> Duck Code Sight - the same software that powers the world's largest
> code search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> Exist-open mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/exist-open

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Importing files from local file system

hendrickst
In reply to this post by Loren Cahlander
Disregard. It did work. I realized the error of my ways. It started as a csv when I originally received the file but an upstream developer had to modify the file to use tilde instead of commas due to some issues he ran into from his feed. I changed the mime to txt/plain and it works perfectly. Thanks for your help!

-----Original Message-----
From: Hendricks Trevor
Sent: Wednesday, July 23, 2014 2:56 PM
To: 'Loren Cahlander'
Cc: [hidden email]
Subject: RE: [Exist-open] Importing files from local file system

Unfortunately this did not work. I'm getting the following error.

XMLDB reported an exception while storing documentorg.xmldb.api.base.XMLDBException: The XML parser reported a problem: fatal error at (1,1) : Content is not allowed in prolog.

I'm running eXist 1.4.5 currently (upgrading in the next few months) so that may be the problem.

-----Original Message-----
From: Loren Cahlander [mailto:[hidden email]]
Sent: Wednesday, July 23, 2014 2:04 PM
To: Hendricks Trevor
Cc: [hidden email]
Subject: Re: [Exist-open] Importing files from local file system

Xmldb:store('/db/temp', 'import.csv', file:read-binary('D:\temp\import.csv'), 'text/csv')

You will need to run as a DBA user to run a file function.

Sent from my iPad

> On Jul 23, 2014, at 1:14 PM, Hendricks Trevor <[hidden email]> wrote:
>
> I can't recall how to do this and am looking for help. I need to import a file from the local system to eXist. The server is a Windows box and the following are the basics.
>
> I'm trying to import a csv (say import.csv) from D:\temp directory to /db/temp collection.
>
> Xmldb:store('/db/temp', 'import.csv', 'D:\temp\import.csv') isn't working. I know my issue is in the third parameter but I don't recall the proper format. Any help is appreciated.
>
>
> Trevor Hendricks
> (A)bort (R)etry (I)nfluence with large hammer.
>
>
>
> ----------------------------------------------------------------------
> -------- Want fast and easy access to all the code in your enterprise?
> Index and search up to 200,000 lines of code with a free copy of Black
> Duck Code Sight - the same software that powers the world's largest
> code search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> Exist-open mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/exist-open

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Importing files from local file system

hendrickst
In reply to this post by Joe Wicentowski

Thanks for the help as well. I did end up using Loren’s suggestion in the end but this worked as well.

 

From: Joe Wicentowski [mailto:[hidden email]]
Sent: Wednesday, July 23, 2014 1:46 PM
To: Hendricks Trevor
Cc: [hidden email]
Subject: Re: [Exist-open] Importing files from local file system

 

Hi Trevor,

 

This should give you the gist (pun intended):

 

 

Joe

 

On Wed, Jul 23, 2014 at 1:14 PM, Hendricks Trevor <[hidden email]> wrote:

I can't recall how to do this and am looking for help. I need to import a file from the local system to eXist. The server is a Windows box and the following are the basics.

I'm trying to import a csv (say import.csv) from D:\temp directory to /db/temp collection.

Xmldb:store('/db/temp', 'import.csv', 'D:\temp\import.csv') isn't working. I know my issue is in the third parameter but I don't recall the proper format. Any help is appreciated.


Trevor Hendricks
 (A)bort (R)etry (I)nfluence with large hammer.



------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open

 


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open