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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • btroberts
    New Member
    • Aug 2013
    • 1

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

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

    <Book>
    <Title>Databa se 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>Da tabase 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?
    Last edited by btroberts; Aug 6 '13, 11:29 PM. Reason: Wrongly formated text in post
Working...