Hi all
This error has been handled with a lot, but always concerns CSV. I am dealing with simple XML. I am writing a Perl script that first generates a XML file, and then imports it into a BaseX database. Unfortunately, I get the error message:
"." (Line 1): Content is not allowed in prolog. At /BaseXClient.pm line 126
I have tried many things and have been debugging with perl, but as far as I can see the created files are valid XML. The error implies that a connection to the BaseX server is established. Something's wrong with the XML file but I do not know what and how to prevent it. I added the script on pastebin as to not waste space in this email. [1]
The XML is created in the sub createXml. That routine returns the path to the created file, which on line 24 is imported into BaseX. Or at least, that is the goal. But that's where the error occurs. I attached example XML output. The script as well as the output and input are in UTF8.
Thank you in advance
Kind regards
Bram Vanroy
Hi Bram,
I guess I should spend more time with your code, but it seems you are not sending the (required) file contents, but only the file name?
Cheers, Christian
On Tue, Oct 4, 2016 at 12:29 PM, Bram Vanroy bram.vanroy1@student.kuleuven.be wrote:
Hi all
This error has been handled with a lot, but always concerns CSV. I am dealing with simple XML. I am writing a Perl script that first generates a XML file, and then imports it into a BaseX database. Unfortunately, I get the error message:
“…” (Line 1): Content is not allowed in prolog. At /BaseXClient.pm line 126
I have tried many things and have been debugging with perl, but as far as I can see the created files are valid XML. The error implies that a connection to the BaseX server is established. Something’s wrong with the XML file but I do not know what and how to prevent it. I added the script on pastebin as to not waste space in this email. [1]
The XML is created in the sub createXml. That routine returns the path to the created file, which on line 24 is imported into BaseX. Or at least, that is the goal. But that’s where the error occurs. I attached example XML output. The script as well as the output and input are in UTF8.
Thank you in advance
Kind regards
Bram Vanroy
Hi there
Thanks for the reply! That's true, but I thought you were to send an absolute path to the XML file, as is the case when using the basexclient from the terminal? Could you direct me to the documentation of the Session object in the Perl client? I cannot find it (and I find a lot of Java examples).
I'll try to push the contents of the file directly now, I'll get back to you.
Thanks
Bram
-----Oorspronkelijk bericht----- Van: Christian Grün [mailto:christian.gruen@gmail.com] Verzonden: dinsdag 4 oktober 2016 12:37 Aan: Bram Vanroy bram.vanroy1@student.kuleuven.be CC: BaseX basex-talk@mailman.uni-konstanz.de Onderwerp: Re: [basex-talk] Content is not allowed in prolog
Hi Bram,
I guess I should spend more time with your code, but it seems you are not sending the (required) file contents, but only the file name?
Cheers, Christian
On Tue, Oct 4, 2016 at 12:29 PM, Bram Vanroy bram.vanroy1@student.kuleuven.be wrote:
Hi all
This error has been handled with a lot, but always concerns CSV. I am dealing with simple XML. I am writing a Perl script that first generates a XML file, and then imports it into a BaseX database. Unfortunately, I get the error message:
“…” (Line 1): Content is not allowed in prolog. At /BaseXClient.pm line 126
I have tried many things and have been debugging with perl, but as far as I can see the created files are valid XML. The error implies that a connection to the BaseX server is established. Something’s wrong with the XML file but I do not know what and how to prevent it. I added the script on pastebin as to not waste space in this email. [1]
The XML is created in the sub createXml. That routine returns the path to the created file, which on line 24 is imported into BaseX. Or at least, that is the goal. But that’s where the error occurs. I attached example XML output. The script as well as the output and input are in UTF8.
Thank you in advance
Kind regards
Bram Vanroy
Hi Bram,
Thanks for the reply! That's true, but I thought you were to send an absolute path to the XML file, as is the case when using the basexclient from the terminal? Could you direct me to the documentation of the Session object in the Perl client? I cannot find it (and I find a lot of Java examples).
I assume there is no such documentation for the Perl client, but as the client is very light-weight, you can have a direct look into the implementation (I hope it’s self-explanatory) [1].
In the Clients article, I have readded a link to the Server Protocol [2], which gives some more information on the available commands.
Cheers Christian
[1] https://github.com/BaseXdb/basex/blob/master/basex-api/src/main/perl/BaseXCl... [2] http://docs.basex.org/wiki/Clients
Hi Christian
I kept running into encoding issues when trying to send the data from Perl to BaseX through the `create` method (even after `use utf8`, a valid XML header with encoding, a verified UTF-8 XML document. The issues do not occur when simple `execute`-ing a CREATE DB command. So I'll do it like that.
Thanks!
Bram
-----Oorspronkelijk bericht----- Van: Christian Grün [mailto:christian.gruen@gmail.com] Verzonden: dinsdag 4 oktober 2016 13:24 Aan: Bram Vanroy bram.vanroy1@student.kuleuven.be CC: BaseX basex-talk@mailman.uni-konstanz.de Onderwerp: Re: [basex-talk] Content is not allowed in prolog
Hi Bram,
Thanks for the reply! That's true, but I thought you were to send an absolute path to the XML file, as is the case when using the basexclient from the terminal? Could you direct me to the documentation of the Session object in the Perl client? I cannot find it (and I find a lot of Java examples).
I assume there is no such documentation for the Perl client, but as the client is very light-weight, you can have a direct look into the implementation (I hope it’s self-explanatory) [1].
In the Clients article, I have readded a link to the Server Protocol [2], which gives some more information on the available commands.
Cheers Christian
[1] https://github.com/BaseXdb/basex/blob/master/basex-api/src/main/perl/BaseXCl... [2] http://docs.basex.org/wiki/Clients
basex-talk@mailman.uni-konstanz.de