Content is not allowed in prolog
Tuesday, 4 October 2016 · 5 messages
BV
Bram Vanroy4 Oct 2016 12:29 #
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
[1]: http://pastebin.com/MhA8eBJf
CG
Christian Grün4 Oct 2016 12:36 #
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
Quoted text · Bram Vanroy · 47 lines
On Tue, Oct 4, 2016 at 12:29 PM, Bram Vanroy <bram.vanroy1 at 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 > > > > [1]: http://pastebin.com/MhA8eBJf > >
BV
Bram Vanroy4 Oct 2016 13:15 #
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-----
Quoted text · Christian Grün · 56 lines
Van: Christian Grün [mailto:christian.gruen at gmail.com] Verzonden: dinsdag 4 oktober 2016 12:37 Aan: Bram Vanroy <bram.vanroy1 at student.kuleuven.be> CC: BaseX <basex-talk at 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 at 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 > > > > [1]: http://pastebin.com/MhA8eBJf > >
CG
Christian Grün4 Oct 2016 13:24 #
Hi Bram,
Quoted text · Bram Vanroy · 1 line
> 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/BaseXClient.pm [2] http://docs.basex.org/wiki/Clients
BV
Bram Vanroy4 Oct 2016 14:54 #
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-----Quoted text · Christian Grün · 13 lines
Van: Christian Grün [mailto:christian.gruen at gmail.com] Verzonden: dinsdag 4 oktober 2016 13:24 Aan: Bram Vanroy <bram.vanroy1 at student.kuleuven.be> CC: BaseX <basex-talk at 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/BaseXClient.pm [2] http://docs.basex.org/wiki/Clients
Written for BaseX 8.5. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery