By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,966 Members | 2,054 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,966 IT Pros & Developers. It's quick & easy.

When loading tree structured XML file into postgresql is it necessary to remove the C

P: 1
To illustrate the issue here is a very basic XML file that is structured with indents and has CR/LF characters.

<Book>
<Title>Database How To</Title>
</Book>

If I try to copy this into the postgresql database with the following sql.

COPY BOOKS from 'books.txt';

I get an error. "Entity: line 1: parser error : Premature end of data in tag Book."

I can successfully load the file if I structure the file differently so that all the xml is on one line as per below.


<Book><Title>Database How To</Title></Book>

This leads me to think that I need to unstructure the XML so each entry is on one line.

Is there any method to load without having to parse the file via "sed" to remove all CR/LF characters?
Aug 6 '13 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.