Quantcast

How to use file:serialize

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to use file:serialize

acco113
Hey there!

First of all I'm a beginner, so please be patient.

My question:
Is there any working example available on how to use the file:serialize function?
I'm currently trying to get it working, without success.

This my test query:

xquery version "1.0";

import module namespace file="http://exist-db.org/xquery/file";
declare option exist:serialize "method=xhtml media-type=text/html indent=yes";

let $login := xmldb:login('path/to/collection', 'myuser', 'mypw')
let $hello := <hello />
let $success := file:serialize($hello, 'path/to/file', '')
let $page :=
<html>
  <head></head>
  <body>{$success}</body>
</html>

return $page

When running this query in my browser I get:
"Error found
Message: Error
null"

This is my version:
# Version: 1.4.0
# SVN Revision: 10440
# Build: 20110527

Thanks in advance for any help, and sorry if I missed something.

Kind regards
Christian
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to use file:serialize

Loren Cahlander

If you take a look at the finction documentation, you will see that the file module requires a member of the dba group to execute.  The is a security feature.  You can read the function docs for the file module at: http://demo.exist-db.org/exist/functions/file

file

A module for performing various operations on files and directories stored in the server file system.
serialize

file:serialize($node-set as node()*, $filepath as xs:string, $parameters as xs:string*) xs:boolean?
Writes the node set into a file on the file system. $parameters contains a sequence of zero or more serialization parameters specified as key=value pairs. The serialization options are the same as those recognized by "declare option exist:serialize". The function does NOT automatically inherit the serialization options of the XQuery it is called from. This method is only available to the DBA role.
$node-setThe contents to write to the file system.
$filepathThe full path to the file
$parametersThe serialization parameters specified as key-value pairs

Returns true on success - false if the specified file can not be created or is not writable. The empty sequence is returned if the argument sequence is empty.
serialize

file:serialize($node-set as node()*, $filepath as xs:string, $parameters as xs:string*, $append as xs:boolean) xs:boolean?
Writes the node set into a file on the file system, optionally appending to it. $parameters contains a sequence of zero or more serialization parameters specified as key=value pairs. The serialization options are the same as those recognized by "declare option exist:serialize". The function does NOT automatically inherit the serialization options of the XQuery it is called from. This method is only available to the DBA role.
$node-setThe contents to write to the file system.
$filepathThe full path to the file
$parametersThe serialization parameters specified as key-value pairs
$appendShould content be appended?

Returns true on success - false if the specified file can not be created or is not writable. The empty sequence is returned if the argument sequence is empty.


On Jun 10, 2011, at 9:20 AM, acco113 wrote:

Hey there!

First of all I'm a beginner, so please be patient.

My question:
Is there any working example available on how to use the file:serialize
function?
I'm currently trying to get it working, without success.

This my test query:

xquery version "1.0";

import module namespace file="http://exist-db.org/xquery/file";
declare option exist:serialize "method=xhtml media-type=text/html
indent=yes";

let $login := xmldb:login('path/to/collection', 'myuser', 'mypw')
let $hello := <hello />
let $success := file:serialize($hello, 'path/to/file', '')
let $page :=
<html>
 <head></head>
 <body>{$success}</body>
</html>

return $page

When running this query in my browser I get:
"Error found
Message: Error
null"

This is my version:
# Version: 1.4.0
# SVN Revision: 10440
# Build: 20110527

Thanks in advance for any help, and sorry if I missed something.

Kind regards
Christian

--
View this message in context: http://exist.2174344.n4.nabble.com/How-to-use-file-serialize-tp3588546p3588546.html
Sent from the exist-open mailing list archive at Nabble.com.

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open


------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to use file:serialize

acco113
Hi,

thanks for your quick reply.

When I execute the query, I replace "myuser" with the default admin user created by eXist who is member of the dba group. So my query should work like I implemented it?

Thanks in advance.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to use file:serialize

Joe Wicentowski
In reply to this post by Loren Cahlander
Loren,

> If you take a look at the finction documentation, you will see that the file module requires a member of the dba group to execute.  The is a security feature.  You can read the function docs for the file module at: http://demo.exist-db.org/exist/functions/file

If you're right and the problem is that Christian is not using the
admin account or an account belonging to the dba group, then isn't the
error message odd?

> When running this query in my browser I get:
> "Error found
> Message: Error
> null"

Shouldn't the error message be, "you must be a member of the dba
group" or something like that?  I fear this suggests a different
error; otherwise, the error message is pretty unhelpful!

Christian - please let us know your results.  If Loren's suggestion
works, then we should really present a more helpful error message.

Christian - could you also check to make sure that the file module is
enabled?  The util:registered-modules() function should return a list
of all registered modules.  You should see "file" as one of the
results.  If you don't, then you'll need to enable the file module in
your conf.xml and restart eXist.

Cheers,
Joe

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to use file:serialize

Loren Cahlander
In reply to this post by acco113
Correct.  Please let us know the results.  It is obvious that the error message does need work.

On Jun 10, 2011, at 10:26 AM, acco113 wrote:

> Hi,
>
> thanks for your quick reply.
>
> When I execute the query, I replace "myuser" with the default admin user
> created by eXist who is member of the dba group. So my query should work
> like I implemented it?
>
> Thanks in advance.
>
> --
> View this message in context: http://exist.2174344.n4.nabble.com/How-to-use-file-serialize-tp3588546p3588699.html
> Sent from the exist-open mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> Exist-open mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/exist-open


------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to use file:serialize

acco113
Hi,

sorry for the late response, I was kind of busy the last days.

As I mentioned I'm logging  in as the default admin user, who is member of the dba group.

This is the output of the util:registered-modules() function:

http://exist-db.org/xquery/examples 
http://exist-db.org/xquery/session 
http://exist-db.org/xquery/text 
http://exist-db.org/xquery/jndi 
http://exist-db.org/xquery/util 
http://exist-db.org/xquery/system 
http://exist-db.org/xquery/httpclient 
http://www.w3.org/2005/xpath-functions 
http://exist-db.org/xquery/validation 
http://exist-db.org/xquery/lucene 
http://exist-db.org/xquery/file 
http://exist-db.org/xquery/request 
http://exist-db.org/xquery/xmldb 
http://exist-db.org/xquery/transform 
http://exist-db.org/xquery/response 
http://exist-db.org/xquery/ngram

So the file module seems to be loaded. What I also tried is to use the deprecated util:serialize function, this gives me the same odd error message. Any ideas?

Kind regards
Christian
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to use file:serialize

Adam Retter
In reply to this post by acco113
Can you check your exist.log file for exceptions when you call this
function and let us know the stacktrace...

On 10 June 2011 16:20, acco113 <[hidden email]> wrote:

> Hey there!
>
> First of all I'm a beginner, so please be patient.
>
> My question:
> Is there any working example available on how to use the file:serialize
> function?
> I'm currently trying to get it working, without success.
>
> This my test query:
>
> xquery version "1.0";
>
> import module namespace file="http://exist-db.org/xquery/file";
> declare option exist:serialize "method=xhtml media-type=text/html
> indent=yes";
>
> let $login := xmldb:login('path/to/collection', 'myuser', 'mypw')
> let $hello := <hello />
> let $success := file:serialize($hello, 'path/to/file', '')
> let $page :=
> <html>
>  <head></head>
>  <body>{$success}</body>
> </html>
>
> return $page
>
> When running this query in my browser I get:
> "Error found
> Message: Error
> null"
>
> This is my version:
> # Version: 1.4.0
> # SVN Revision: 10440
> # Build: 20110527
>
> Thanks in advance for any help, and sorry if I missed something.
>
> Kind regards
> Christian
>
> --
> View this message in context: http://exist.2174344.n4.nabble.com/How-to-use-file-serialize-tp3588546p3588546.html
> Sent from the exist-open mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> Exist-open mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/exist-open
>



--
Adam Retter

eXist Developer
{ United Kingdom }
[hidden email]
irc://irc.freenode.net/existdb

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to use file:serialize

acco113
Hi,

can you tell me where the exist.log file is located? Normally when an error occurs I get the Stacktrace via my browser.
In this case I only get the message mentioned above.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to use file:serialize

acco113
In reply to this post by Adam Retter
Nevermind, I found it myself.
This is the output when I execute the query:

2011-06-14 12:02:38,466 [P1-9] ERROR (XQueryServlet.java [process]:438) -
java.lang.NullPointerException
        at org.exist.xquery.modules.file.SerializeToFile.parseXMLSerializationOptions(SerializeToFile.java:158)
        at org.exist.xquery.modules.file.SerializeToFile.eval(SerializeToFile.java:130)
        at org.exist.xquery.BasicFunction.eval(BasicFunction.java:68)
        at org.exist.xquery.InternalFunctionCall.eval(InternalFunctionCall.java:55)
        at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61)
        at org.exist.xquery.PathExpr.eval(PathExpr.java:241)
        at org.exist.xquery.LetExpr.eval(LetExpr.java:155)
        at org.exist.xquery.LetExpr.eval(LetExpr.java:206)
        at org.exist.xquery.LetExpr.eval(LetExpr.java:206)
        at org.exist.xquery.LetExpr.eval(LetExpr.java:206)
        at org.exist.xquery.BindingExpression.eval(BindingExpression.java:158)
        at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61)
        at org.exist.xquery.PathExpr.eval(PathExpr.java:241)
        at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61)
        at org.exist.xquery.XQuery.execute(XQuery.java:228)
        at org.exist.xquery.XQuery.execute(XQuery.java:183)
        at org.exist.xmldb.LocalXPathQueryService.execute(LocalXPathQueryService.java:185)
        at org.exist.http.servlets.XQueryServlet.process(XQueryServlet.java:414)
        at org.exist.http.servlets.XQueryServlet.doGet(XQueryServlet.java:171)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
        at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:473)
        at org.mortbay.jetty.servlet.Dispatcher.dispatch(Dispatcher.java:263)
        at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:171)
        at org.exist.http.urlrewrite.Forward.doRewrite(Forward.java:44)
        at org.exist.http.urlrewrite.XQueryURLRewrite.doRewrite(XQueryURLRewrite.java:432)
        at org.exist.http.urlrewrite.XQueryURLRewrite.doFilter(XQueryURLRewrite.java:303)
        at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
        at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:471)
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
        at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
        at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:633)
        at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
        at org.mortbay.http.HttpServer.service(HttpServer.java:909)
        at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
        at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
        at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
        at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
        at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
        at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to use file:serialize

Adam Retter
Ah okay,

So I think the problem is your third argument to the function - you
are using an Empty string, you should use the Empty sequence instead
to indicate no parameters, e.g. -

file:serialize($hello, 'path/to/file', ())


On 14 June 2011 12:06, acco113 <[hidden email]> wrote:

> Nevermind, I found it myself.
> This is the output when I execute the query:
>
> 2011-06-14 12:02:38,466 [P1-9] ERROR (XQueryServlet.java [process]:438) -
> java.lang.NullPointerException
>        at
> org.exist.xquery.modules.file.SerializeToFile.parseXMLSerializationOptions(SerializeToFile.java:158)
>        at
> org.exist.xquery.modules.file.SerializeToFile.eval(SerializeToFile.java:130)
>        at org.exist.xquery.BasicFunction.eval(BasicFunction.java:68)
>        at
> org.exist.xquery.InternalFunctionCall.eval(InternalFunctionCall.java:55)
>        at
> org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61)
>        at org.exist.xquery.PathExpr.eval(PathExpr.java:241)
>        at org.exist.xquery.LetExpr.eval(LetExpr.java:155)
>        at org.exist.xquery.LetExpr.eval(LetExpr.java:206)
>        at org.exist.xquery.LetExpr.eval(LetExpr.java:206)
>        at org.exist.xquery.LetExpr.eval(LetExpr.java:206)
>        at
> org.exist.xquery.BindingExpression.eval(BindingExpression.java:158)
>        at
> org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61)
>        at org.exist.xquery.PathExpr.eval(PathExpr.java:241)
>        at
> org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61)
>        at org.exist.xquery.XQuery.execute(XQuery.java:228)
>        at org.exist.xquery.XQuery.execute(XQuery.java:183)
>        at
> org.exist.xmldb.LocalXPathQueryService.execute(LocalXPathQueryService.java:185)
>        at
> org.exist.http.servlets.XQueryServlet.process(XQueryServlet.java:414)
>        at
> org.exist.http.servlets.XQueryServlet.doGet(XQueryServlet.java:171)
>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>        at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
>        at
> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:473)
>        at
> org.mortbay.jetty.servlet.Dispatcher.dispatch(Dispatcher.java:263)
>        at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:171)
>        at org.exist.http.urlrewrite.Forward.doRewrite(Forward.java:44)
>        at
> org.exist.http.urlrewrite.XQueryURLRewrite.doRewrite(XQueryURLRewrite.java:432)
>        at
> org.exist.http.urlrewrite.XQueryURLRewrite.doFilter(XQueryURLRewrite.java:303)
>        at
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
>        at
> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:471)
>        at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
>        at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
>        at
> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:633)
>        at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
>        at org.mortbay.http.HttpServer.service(HttpServer.java:909)
>        at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
>        at
> org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
>        at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
>        at
> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
>        at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
>        at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
>
>
> --
> View this message in context: http://exist.2174344.n4.nabble.com/How-to-use-file-serialize-tp3588546p3596133.html
> Sent from the exist-open mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> Exist-open mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/exist-open
>



--
Adam Retter

eXist Developer
{ United Kingdom }
[hidden email]
irc://irc.freenode.net/existdb

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to use file:serialize

Adam Retter
I just committed revisions 14690 and 14691 to trunk and 1.4.x
respectively, this will avoid others experiencing this issue in future
also.

On 14 June 2011 14:25, Adam Retter <[hidden email]> wrote:

> Ah okay,
>
> So I think the problem is your third argument to the function - you
> are using an Empty string, you should use the Empty sequence instead
> to indicate no parameters, e.g. -
>
> file:serialize($hello, 'path/to/file', ())
>
>
> On 14 June 2011 12:06, acco113 <[hidden email]> wrote:
>> Nevermind, I found it myself.
>> This is the output when I execute the query:
>>
>> 2011-06-14 12:02:38,466 [P1-9] ERROR (XQueryServlet.java [process]:438) -
>> java.lang.NullPointerException
>>        at
>> org.exist.xquery.modules.file.SerializeToFile.parseXMLSerializationOptions(SerializeToFile.java:158)
>>        at
>> org.exist.xquery.modules.file.SerializeToFile.eval(SerializeToFile.java:130)
>>        at org.exist.xquery.BasicFunction.eval(BasicFunction.java:68)
>>        at
>> org.exist.xquery.InternalFunctionCall.eval(InternalFunctionCall.java:55)
>>        at
>> org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61)
>>        at org.exist.xquery.PathExpr.eval(PathExpr.java:241)
>>        at org.exist.xquery.LetExpr.eval(LetExpr.java:155)
>>        at org.exist.xquery.LetExpr.eval(LetExpr.java:206)
>>        at org.exist.xquery.LetExpr.eval(LetExpr.java:206)
>>        at org.exist.xquery.LetExpr.eval(LetExpr.java:206)
>>        at
>> org.exist.xquery.BindingExpression.eval(BindingExpression.java:158)
>>        at
>> org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61)
>>        at org.exist.xquery.PathExpr.eval(PathExpr.java:241)
>>        at
>> org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61)
>>        at org.exist.xquery.XQuery.execute(XQuery.java:228)
>>        at org.exist.xquery.XQuery.execute(XQuery.java:183)
>>        at
>> org.exist.xmldb.LocalXPathQueryService.execute(LocalXPathQueryService.java:185)
>>        at
>> org.exist.http.servlets.XQueryServlet.process(XQueryServlet.java:414)
>>        at
>> org.exist.http.servlets.XQueryServlet.doGet(XQueryServlet.java:171)
>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>>        at
>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
>>        at
>> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:473)
>>        at
>> org.mortbay.jetty.servlet.Dispatcher.dispatch(Dispatcher.java:263)
>>        at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:171)
>>        at org.exist.http.urlrewrite.Forward.doRewrite(Forward.java:44)
>>        at
>> org.exist.http.urlrewrite.XQueryURLRewrite.doRewrite(XQueryURLRewrite.java:432)
>>        at
>> org.exist.http.urlrewrite.XQueryURLRewrite.doFilter(XQueryURLRewrite.java:303)
>>        at
>> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
>>        at
>> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:471)
>>        at
>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
>>        at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
>>        at
>> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:633)
>>        at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
>>        at org.mortbay.http.HttpServer.service(HttpServer.java:909)
>>        at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
>>        at
>> org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
>>        at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
>>        at
>> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
>>        at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
>>        at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
>>
>>
>> --
>> View this message in context: http://exist.2174344.n4.nabble.com/How-to-use-file-serialize-tp3588546p3596133.html
>> Sent from the exist-open mailing list archive at Nabble.com.
>>
>> ------------------------------------------------------------------------------
>> EditLive Enterprise is the world's most technically advanced content
>> authoring tool. Experience the power of Track Changes, Inline Image
>> Editing and ensure content is compliant with Accessibility Checking.
>> http://p.sf.net/sfu/ephox-dev2dev
>> _______________________________________________
>> Exist-open mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/exist-open
>>
>
>
>
> --
> Adam Retter
>
> eXist Developer
> { United Kingdom }
> [hidden email]
> irc://irc.freenode.net/existdb
>



--
Adam Retter

eXist Developer
{ United Kingdom }
[hidden email]
irc://irc.freenode.net/existdb

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to use file:serialize

acco113
Hey,

that did the trick.
Thank you so much everybody.

Cheers
Christian
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to use file:serialize

Peter Watson
Hi

I have followed this post in trying to get file:serialize to work.  I'm pretty sure I am logged in as DBA.  The error message I get is:
" Cannot serialize file. A problem ocurred while serializing the node set: xmldb:exist:\db\punch\data\eg.xml (The filename, directory name, or volume label syntax is incorrect) [at line 28, column 1]"

The code I used for serialize is :

file:serialize($pairs, 'xmldb:exist:///db/punch/data/eg.xml', ())

eg.xml is a new file and I am not sure whether I need to alter the syntax to allow for this.

I am using
eXist Version: 1.4.1dev
eXist Build: 20110624
SVN Revision: 14669
on Windows 7

I have tried every which way to find the appropriate way of setting the file path though it is still likely I am missing something silly.  Any thoughts gratefully received.

Peter
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to use file:serialize

Adam Retter
I think there is some confusion ;-)

If you want to store into the database, and I guess you do given the
file path you have used, then you should use xmldb:store() function
and not file:serialize, which is for writing to the filesystem.

On 30 June 2011 11:06, Peter Watson <[hidden email]> wrote:

> Hi
>
> I have followed this post in trying to get file:serialize to work.  I'm
> pretty sure I am logged in as DBA.  The error message I get is:
> " Cannot serialize file. A problem ocurred while serializing the node set:
> xmldb:exist:\db\punch\data\eg.xml (The filename, directory name, or volume
> label syntax is incorrect) [at line 28, column 1]"
>
> The code I used for serialize is :
>
> file:serialize($pairs, 'xmldb:exist:///db/punch/data/eg.xml', ())
>
> eg.xml is a new file and I am not sure whether I need to alter the syntax to
> allow for this.
>
> I am using
> eXist Version:  1.4.1dev
> eXist Build:    20110624
> SVN Revision:   14669
> on Windows 7
>
> I have tried every which way to find the appropriate way of setting the file
> path though it is still likely I am missing something silly.  Any thoughts
> gratefully received.
>
> Peter
>
> --
> View this message in context: http://exist.2174344.n4.nabble.com/How-to-use-file-serialize-tp3588546p3635159.html
> Sent from the exist-open mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2d-c2
> _______________________________________________
> Exist-open mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/exist-open
>



--
Adam Retter

eXist Developer
{ United Kingdom }
[hidden email]
irc://irc.freenode.net/existdb

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Loading...