From: Mattio V. <mat...@gm...> - 2008-11-22 19:08:49
|
Hello, I just downloaded and installed eXist and I'm trying to load some XML files. Since I'll be loading the documents via code if I use the system, I was trying to write XQuery for loading in the sandbox. Unfortunately I keep getting the same error. The XQuery I'm trying to run is: declare namespace xmldb="http://exist-db.org/xquery/xmldb"; let $load-status := xmldb:store("test", "test.xml", "C:\test.xml") return <load-status> { $load-status } </load-status> The XML file is: <?xml version="1.0" encoding="utf-8"?> <root> <p>Sample paragraph.</p> </root> The error message I'm getting is: Error while evaluating expression: declare namespace xmldb="http://exist-db.org/xquery/xmldb"; let $load-status := xmldb:store("test", "test.xml", "C:\test.xml") return { $load-status } . XMLDB reported an exception while storing documentorg.xmldb.api.base.XMLDBException: fatal error at (1,1) : Content is not allowed in prolog. [at line 120, column 21] In call to function: sandbox:exec-query(xs:string) [134:10] I found a couple of eXist emails about this error relating to BOM, but they're several years old. Any suggestions or pointers? Thanks! |
From: Dannes W. <di...@ex...> - 2008-11-22 20:20:24
|
Hi, Mattio Valentino wrote: > XMLDB reported an exception while storing > documentorg.xmldb.api.base.XMLDBException: fatal error at (1,1) : > Content is not allowed in prolog. [at line 120, column 21] In call to > function: sandbox:exec-query(xs:string) [134:10] > > I found a couple of eXist emails about this error relating to BOM, but > they're several years old. > Normally, this error represents an actual problem in the document that is being parsed. So either a different document is parsed than expected or... the document is 'dirty'. Do you you have an editor around to view the document? Or byte editor? I had problems with Ultra-edit for quite some time.... cheers Dannes |
From: Mattio V. <mat...@gm...> - 2008-11-22 20:57:48
|
Thanks for the quick response, Dannes. I have UltraEdit, but I'll find another hex editor to see what's going on. In the meantime, I found one of the samples and tried loading it but the same error appears. I ran: declare namespace xmldb="http://exist-db.org/xquery/xmldb"; xmldb:store("test", "test.xml", "C:\Program Files\eXist\samples\shakespeare\hamlet.xml") And the error was: Error while evaluating expression: declare namespace xmldb="http://exist-db.org/xquery/xmldb"; xmldb:store("test", "test.xml", "C:\Program Files\eXist\samples\shakespeare\hamlet.xml") . XMLDB reported an exception while storing documentorg.xmldb.api.base.XMLDBException: fatal error at (1,1) : Content is not allowed in prolog. [at line 120, column 21] In call to function: sandbox:exec-query(xs:string) [134:10] I tried running this in Firefox and Chrome with the same response. I'm on Windows XP Pro, if that helps. On Sat, Nov 22, 2008 at 3:19 PM, Dannes Wessels <di...@ex...> wrote: > > Normally, this error represents an actual problem in the document that is > being parsed. So either a different document is parsed than expected or... > the document is 'dirty'. Do you you have an editor around to view the > document? Or byte editor? > > I had problems with Ultra-edit for quite some time.... > > cheers > > Dannes > |
From: Wolfgang <wol...@ex...> - 2008-11-22 22:15:40
|
> I ran: > > declare namespace xmldb="http://exist-db.org/xquery/xmldb"; > xmldb:store("test", "test.xml", "C:\Program > Files\eXist\samples\shakespeare\hamlet.xml") xmldb:store looks at the type of the 3rd argument: if you pass a string, the function believes it should parse that string into XML and store it. You thus get a parsing error because "C:\Program..." is not valid XML. You have to make sure that the 3rd argument is recognized as an URI: xmldb:store("test", "test.xml", xs:anyURI(".../shakespeare/hamlet.xml")) Wolfgang |
From: Mattio V. <mat...@gm...> - 2008-11-23 01:00:18
|
Thanks Wolfgang. That cleared up the error, but the document didn't load with that approach. From where is the path relative from? I tried to use C:\ since I'm on a Windows machine, but it threw and invalid URI error. When I used "/samples/mattio/sample.xml" or "../samples/mattio/sample.xml" nothing loaded and no error was thrown. On the other hand, when I switched to use xmldb:store-files-from-pattern($collection, "C:\Program Files\eXist\samples\mattio", "*.xml") the document did load fine. On Sat, Nov 22, 2008 at 5:10 PM, Wolfgang <wol...@ex...> wrote: >> I ran: >> >> declare namespace xmldb="http://exist-db.org/xquery/xmldb"; >> xmldb:store("test", "test.xml", "C:\Program >> Files\eXist\samples\shakespeare\hamlet.xml") > > xmldb:store looks at the type of the 3rd argument: if you pass a string, the > function believes it should parse that string into XML and store it. You > thus get a parsing error because "C:\Program..." is not valid XML. > > You have to make sure that the 3rd argument is recognized as an URI: > > xmldb:store("test", "test.xml", xs:anyURI(".../shakespeare/hamlet.xml")) > > Wolfgang > |
From: Dannes W. <di...@ex...> - 2008-11-23 11:22:29
|
Hi, On Sun, Nov 23, 2008 at 2:00 AM, Mattio Valentino <mat...@gm...> wrote: > That cleared up the error, but the document didn't load with that > approach. From where is the path relative from? I tried to use C:\ > since I'm on a Windows machine, but it threw and invalid URI error. sure, C:\ cannot be a URI, there should be a foreward slash ; file:///C:/path/doc.xml should work ? cheers Dannes -- eXist-db Native XML Database - http://exist-db.org Join us on linked-in: http://www.linkedin.com/groups?gid=35624 |