Hi Selven,
I tend to use something like the following code to upload my modules:
let $datapath := xdmp:modules-root()
for $file in xdmp:filesystem-directory($datapath)//*:entry[*:type =
"file"]
let $name := string($file//*:filename)
let $text :=
xdmp:filesystem-file(concat($datapath, $name))
return
xdmp:document-insert(concat("/sdu/mashup/actions/", $name),
document { $text } )
Note: this code inserts the modules in the current documents database. So
either run this from CQ, specifying a specific database (Modules or Training in
your case), or run this code using an xdmp:eval with a database option.
Something like:
xdmp:eval(' (: ..replace this comment with the actual code.. :) ', (),
<options xmlns="xdmp:eval">
<database>{xdmp:database('Modules')}</database>
</options>
)
But make sure that the module does not already exist with a wrong data type.
Once inserted as XML or binary, you need to explicitly remove and reinsert it
to change its type. It might help clearing the database and trying again from a
fresh start.
Kind regards,
Geert
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Selven Xavier
> Sent: dinsdag 6 oktober 2009 13:29
> To: [email protected]
> Subject: [MarkLogic Dev General] Re: Clarification on usage
> of "evaluation context" under domain
>
> Hi Geert,
>
> Thanks for your information. As mention, we have changed root
> directory pointing to "/" in "evaluation context". Also we
> have kept action and condition xqy files under the training
> database. But we are facing same problem.
>
>
>
> When we try to insert html file through cq using
> document-insert query, we end up with following error message
> in log file.
>
> ---Error Log Message---------
>
>
>
> 2009-10-06 16:30:05.103 Notice: 8086-cq: XDMP-DOCXMLCHAR:
> xdmp:unquote("<query-history> <query>xdmp:document-insert(
> "/testdata....", "com.marklogic.developer.cq.session",
> ("repair-none", "format-xml")) -- Invalid XML character
> codepoint 1 at line 84 -- document contains non-XML character
>
> 2009-10-06 16:30:05.103 Notice: 8086-cq: in
> /update-session.xqy, on line 58 [1.0-ml]
>
> 2009-10-06 16:30:05.103 Notice: 8086-cq: in
> /update-session.xqy, on line 72 [1.0-ml]
>
>
>
> But as suggested, if we have action and condition xqy files
> under Modules database we are able to convert html file into
> xhtml file
>
>
> Please do the needful.
>
> Regards,
> Selven Xavier .A
>
>
> On Tue, Oct 6, 2009 at 3:50 PM,
> <[email protected]> wrote:
>
>
> Send General mailing list submissions to
> [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://xqzone.com/mailman/listinfo/general
> or, via email, send a message with subject or body 'help' to
> [email protected]
>
> You can reach the person managing the list at
> [email protected]
>
> When replying, please edit your Subject line so it is
> more specific
> than "Re: Contents of General digest..."
>
>
> Today's Topics:
>
> 1. Clarification on usage of ?evaluation context? under domain
> creation (Selven Xavier)
> 2. RE: Clarification on usage of "evaluation context" under
> domain creation (Geert Josten)
>
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 6 Oct 2009 15:29:06 +0530
> From: Selven Xavier <[email protected]>
> Subject: [MarkLogic Dev General] Clarification on usage
> of ?evaluation
> context? under domain creation
> To: [email protected]
> Message-ID:
>
> <[email protected]>
> Content-Type: text/plain; charset="windows-1252"
>
> Hi Team,
>
>
>
> We have created and loaded new custompipeline.xml which
> convert html to
> xhtml document. The custompipeline.xml looks as shown below:
>
>
>
> <success-action>
>
> <module*>/ML/cpf/actions*/success-action.xqy</module>
>
> </success-action>
>
> <failure-action>
>
> <module*>/ML/cpf/actions*/failure-action.xqy</module>
>
> </failure-action>
>
>
>
> <state-transition>
>
> <annotation>
>
> Convert HTML documents and only HTML documents.
>
> </annotation>
>
>
>
> <state>http://marklogic.com/states/initial</state>
>
>
> <on-success>http://marklogic.com/states/converted</on-success>
>
> <on-failure>http://marklogic.com/states/error</on-failure>
>
> <priority>9200</priority>
>
>
>
> <execute>
>
> <condition>
>
>
> <module>*/ML/cpf/actions*/mimetype-condition.xqy</module>
>
> <options
> xmlns="/ML/cpf/actions/mimetype-condition.xqy">
>
> <mime-type>text/html</mime-type>
>
> </options>
>
> </condition>
>
> <action>
>
>
> <module>*/ML/cpf/actions*/convert-html-action.xqy</module>
>
> <options
> xmlns="/ML/cpf/actions/convert-html-action.xqy">
>
> <destination-root/>
>
> <destination-collection/>
>
> </options>
>
> </action>
>
> </execute>
>
> </state-transition>
>
>
>
> We have also created a "domain" with "evaluation
> context" pointing to the
> created database <<training>> in "module" dropdown and
> "/" in root text box
> [i.e. all the action and condition related pipeline
> files are kept under
> training database in root "/" directory]. When we try
> to drag and drop any
> html file through webdav, the html file is not getting
> converted into xhtml
> file. Following is the error log message we are getting
> in the error log
> file. Please help us on this regards.
>
>
>
>
>
> 2009-10-06 15:19:43.737 Warning: TaskServer: training:
> on-state-enter
> /testfile.html condition failed XDMP-TEXTNODE:
> /training/ML/cpf/actions/mimetype-condition.xqy --
> Server unable to build
> program from non-text document
>
> 2009-10-06 15:19:44.018 Error: TaskServer: training:
> on-state-enter
> /testfile.html action failed XDMP-TEXTNODE:
> /training/ML/cpf/actions/success-action.xqy -- Server
> unable to build
> program from non-text document
>
> 2009-10-06 15:19:44.049 Notice: TaskServer: XDMP-TEXTNODE:
> /training/ML/cpf/actions/failure-action.xqy -- Server
> unable to build
> program from non-text document
>
> 2009-10-06 15:19:44.049 Notice: TaskServer: in
> /ML/cpf/actions/failure-action.xqy,
>
> 2009-10-06 15:19:44.049 Notice: TaskServer: in
> xdmp:invoke("/ML/cpf/actions/failure-action.xqy",
> (xs:QName("trgr:uri"),
> "/testfile.html", xs:QName("trgr:trigger"), ...), <options
>
> xmlns="xdmp:eval"><isolation>different-transaction</isolation>
> <prevent-deadlocks>t...</options>)
> [1.0-ml]
>
> 2009-10-06 15:19:44.049 Notice: TaskServer: in
> /MarkLogic/cpf/triggers/internal-cpf.xqy, on line 172,
>
> 2009-10-06 15:19:44.049 Notice: TaskServer: in
> int:execute-state-transition("on-state-enter", cpf:state("
> http://marklogic.com/states/alerted"), "/testfile.html",
> (xs:QName("trgr:uri"), "/testfile.html",
> xs:QName("trgr:trigger"), ...),
> <trgr:trigger
> xmlns:trgr="http://marklogic.com/xdmp/triggers"><trgr:trigger-
> id>10132513800104736987</trgr:trigger-id><trgr:tri...</trgr:trigger>)
> [0.9-ml]
>
> 2009-10-06 15:19:44.049 Notice: TaskServer: $caller =
> "on-state-enter"
>
> 2009-10-06 15:19:44.049 Notice: TaskServer: $state =
> cpf:state("
> http://marklogic.com/states/alerted")
>
> 2009-10-06 15:19:44.049 Notice: TaskServer: $uri =
> "/testfile.html"
>
> 2009-10-06 15:19:44.049 Notice: TaskServer: $vars =
> (xs:QName("trgr:uri"),
> "/testfile.html", xs:QName("trgr:trigger"), ...)
>
> 2009-10-06 15:19:44.049 Notice: TaskServer: $trigger
> = <trgr:trigger
> xmlns:trgr="http://marklogic.com/xdmp/triggers
>
> "><trgr:trigger-id>10132513800104736987</trgr:trigger-id><trgr
> :tri...</trgr:trigger>
>
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> $trigger-id = <trgr:trigger-id
> xmlns:trgr="http://marklogic.com/xdmp/triggers
> ">10132513800104736987</trgr:trigger-id>
>
> 2009-10-06 15:19:44.049 Notice: TaskServer: $root =
> trgr:root("/training/")
>
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> $pipelines = (fn:doc("
>
> http://marklogic.com/cpf/pipelines/17288113954236635439.xml")/
> p:pipeline,
>
> fn:doc("http://marklogic.com/cpf/pipelines/1458940375957353097
> 0.xml")/p:pipeline,
>
> fn:doc("http://marklogic.com/cpf/pipelines/7089335793612343099.xml
> ")/p:pipeline)
>
> 2009-10-06 15:19:44.049 Notice: TaskServer: $transitions = ()
>
> 2009-10-06 15:19:44.049 Notice: TaskServer: $isolation =
> "different-transaction"
>
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> $ordered-transitions = ()
>
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> $condition-succeeded =
> fn:false()
>
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> $selected-execute = ()
>
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> $action-to-execute = ()
>
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> $chosen-transition =
> <p:null-transition
> xmlns:p="http://marklogic.com/cpf/pipelines"><p:state>
>
> http://marklogic.com/states/alerted</p:state></p:null-transition>
>
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> $action-to-execute = fn:doc("
> http://marklogic.com/cpf/pipelines/17288113954236635439.xml
> ")/p:pipeline/p:success-action
>
> 2009-10-06 15:19:44.049 Notice: TaskServer: $e = <error:error
> xsi:schemaLocation="http://marklogic.com/xdmp/error
> error.xsd" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance" xmlns:error="
> http://marklogic.com/xdmp/error
>
> "><error:code>XDMP-TEXTNODE</error:code><error:name/><error:xq
> uery...</error:error>
>
> 2009-10-06 15:19:44.049 Notice: TaskServer: $trace = ()
>
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> $failure-action = fn:doc("
> http://marklogic.com/cpf/pipelines/17288113954236635439.xml
> ")/p:pipeline/p:failure-action
>
> 2009-10-06 15:19:44.049 Notice: TaskServer: $failure-module =
> "/ML/cpf/actions/failure-action.xqy"
>
> 2009-10-06 15:19:44.049 Notice: TaskServer: in
> /MarkLogic/cpf/triggers/on-state-enter.xqy, on line 40 [0.9-ml]
>
> 2009-10-06 15:19:44.049 Notice: TaskServer: $state =
> cpf:state("
> http://marklogic.com/states/alerted")
>
> 2009-10-06 15:19:44.049 Notice: TaskServer: $trace = ()
>
> 2009-10-06 15:19:44.049 Notice: TaskServer: $vars =
> (xs:QName("trgr:uri"),
> "/testfile.html", xs:QName("trgr:trigger"), ...)
>
>
>
>
>
> Please help us on this regards. Thanks in Advance.
>
>
>
> Regards,
>
> Selven Xavier .A
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://xqzone.marklogic.com/pipermail/general/attachments/2009
> 1006/d0a56522/attachment-0001.html
>
> ------------------------------
>
> Message: 2
> Date: Tue, 6 Oct 2009 12:19:55 +0200
> From: Geert Josten <[email protected]>
> Subject: RE: [MarkLogic Dev General] Clarification on usage of
> "evaluation context" under domain creation
> To: General Mark Logic Developer Discussion
> <[email protected]>
> Message-ID:
>
> <0260356c6dfe754ba6fa48e659a14338334e32b...@helios.olympus.borgus.nl>
> Content-Type: text/plain; charset="us-ascii"
>
> Hi Selven Xavier,
>
> The evaluation context is where the CPF framework will
> be looking for the xquery modules that you configured in you
> pipelines. Pointing to the Training database, means you will
> have to load your modules to the Training database. The root
> is simply prepended to any path you specify in your pipeline
> xml. If you have data in the Training database as well, I
> would recommend using the Modules database for the modules,
> to keep modules and data documents separated.
>
> >From the error log I notice two details:
> - It mentions:
> /training/ML/cpf/actions/success-action.xqy, so it is looking
> within the evaluation context database in a subdir /training.
> Are you sure you have configured the root at '/' and not '/training/'?
> - It complains that the document it found wasn't of
> type text. Make sure that you upload the xquery modules as
> type 'text'. Not specifying a type, and using extension
> '.xqy' should suffice in most cases. But it could also be
> that it simply didn't find your module, as perhaps it is
> looking at the wrong location.
>
> Kind regards,
> Geert
>
>
>
> Drs. G.P.H. Josten
> Consultant
>
>
>
>
> <http://www.daidalos.nl/>
> Daidalos BV
> Source of Innovation
> Hoekeindsehof 1-4
> 2665 JZ Bleiswijk
> Tel.: +31 (0) 10 850 1200
> Fax: +31 (0) 10 850 1199
> www.daidalos.nl <http://www.daidalos.nl/>
> <http://www.daidalos.nl/>
> KvK 27164984
>
>
> De informatie - verzonden in of met dit emailbericht -
> is afkomstig van Daidalos BV en is uitsluitend bestemd voor
> de geadresseerde. Indien u dit bericht onbedoeld hebt
> ontvangen, verzoeken wij u het te verwijderen. Aan dit
> bericht kunnen geen rechten worden ontleend.
>
> ________________________________
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Selven Xavier
> Sent: dinsdag 6 oktober 2009 11:59
> To: [email protected]
> Subject: [MarkLogic Dev General] Clarification on usage
> of "evaluation context" under domain creation
>
> Hi Team,
>
> We have created and loaded new custompipeline.xml which
> convert html to xhtml document. The custompipeline.xml looks
> as shown below:
>
> <success-action>
> <module>/ML/cpf/actions/success-action.xqy</module>
> </success-action>
> <failure-action>
> <module>/ML/cpf/actions/failure-action.xqy</module>
> </failure-action>
>
> <state-transition>
> <annotation>
> Convert HTML documents and only HTML documents.
> </annotation>
>
> <state>http://marklogic.com/states/initial</state>
>
> <on-success>http://marklogic.com/states/converted</on-success>
> <on-failure>http://marklogic.com/states/error</on-failure>
> <priority>9200</priority>
>
> <execute>
> <condition>
>
> <module>/ML/cpf/actions/mimetype-condition.xqy</module>
> <options
> xmlns="/ML/cpf/actions/mimetype-condition.xqy">
> <mime-type>text/html</mime-type>
> </options>
> </condition>
> <action>
>
> <module>/ML/cpf/actions/convert-html-action.xqy</module>
> <options
> xmlns="/ML/cpf/actions/convert-html-action.xqy">
> <destination-root/>
> <destination-collection/>
> </options>
> </action>
> </execute>
> </state-transition>
>
> We have also created a "domain" with "evaluation
> context" pointing to the created database <<training>> in
> "module" dropdown and "/" in root text box [i.e. all the
> action and condition related pipeline files are kept under
> training database in root "/" directory]. When we try to
> drag and drop any html file through webdav, the html file is
> not getting converted into xhtml file. Following is the error
> log message we are getting in the error log file. Please help
> us on this regards.
>
>
> 2009-10-06 15:19:43.737 Warning: TaskServer: training:
> on-state-enter /testfile.html condition failed XDMP-TEXTNODE:
> /training/ML/cpf/actions/mimetype-condition.xqy -- Server
> unable to build program from non-text document
> 2009-10-06 15:19:44.018 Error: TaskServer: training:
> on-state-enter /testfile.html action failed XDMP-TEXTNODE:
> /training/ML/cpf/actions/success-action.xqy -- Server unable
> to build program from non-text document
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> XDMP-TEXTNODE: /training/ML/cpf/actions/failure-action.xqy --
> Server unable to build program from non-text document
> 2009-10-06 15:19:44.049 Notice: TaskServer: in
> /ML/cpf/actions/failure-action.xqy,
> 2009-10-06 15:19:44.049 Notice: TaskServer: in
> xdmp:invoke("/ML/cpf/actions/failure-action.xqy",
> (xs:QName("trgr:uri"), "/testfile.html",
> xs:QName("trgr:trigger"), ...), <options
> xmlns="xdmp:eval"><isolation>different-transaction</isolation>
> <prevent-deadlocks>t...</options>) [1.0-ml]
> 2009-10-06 15:19:44.049 Notice: TaskServer: in
> /MarkLogic/cpf/triggers/internal-cpf.xqy, on line 172,
> 2009-10-06 15:19:44.049 Notice: TaskServer: in
> int:execute-state-transition("on-state-enter",
> cpf:state("http://marklogic.com/states/alerted"),
> "/testfile.html", (xs:QName("trgr:uri"), "/testfile.html",
> xs:QName("trgr:trigger"), ...), <trgr:trigger
> xmlns:trgr="http://marklogic.com/xdmp/triggers"><trgr:trigger-
> id>10132513800104736987</trgr:trigger-id><trgr:tri...</trgr:tr
> igger>) [0.9-ml]
> 2009-10-06 15:19:44.049 Notice: TaskServer: $caller =
> "on-state-enter"
> 2009-10-06 15:19:44.049 Notice: TaskServer: $state =
> cpf:state("http://marklogic.com/states/alerted")
> 2009-10-06 15:19:44.049 Notice: TaskServer: $uri =
> "/testfile.html"
> 2009-10-06 15:19:44.049 Notice: TaskServer: $vars =
> (xs:QName("trgr:uri"), "/testfile.html",
> xs:QName("trgr:trigger"), ...)
> 2009-10-06 15:19:44.049 Notice: TaskServer: $trigger
> = <trgr:trigger
> xmlns:trgr="http://marklogic.com/xdmp/triggers"><trgr:trigger-
> id>10132513800104736987</trgr:trigger-id><trgr:tri...</trgr:trigger>
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> $trigger-id = <trgr:trigger-id
> xmlns:trgr="http://marklogic.com/xdmp/triggers">10132513800104
> 736987</trgr:trigger-id>
> 2009-10-06 15:19:44.049 Notice: TaskServer: $root =
> trgr:root("/training/")
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> $pipelines =
> (fn:doc("http://marklogic.com/cpf/pipelines/172881139542366354
> 39.xml")/p:pipeline,
> fn:doc("http://marklogic.com/cpf/pipelines/1458940375957353097
> 0.xml")/p:pipeline,
> fn:doc("http://marklogic.com/cpf/pipelines/7089335793612343099
> .xml")/p:pipeline)
> 2009-10-06 15:19:44.049 Notice: TaskServer: $transitions = ()
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> $isolation = "different-transaction"
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> $ordered-transitions = ()
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> $condition-succeeded = fn:false()
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> $selected-execute = ()
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> $action-to-execute = ()
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> $chosen-transition = <p:null-transition
> xmlns:p="http://marklogic.com/cpf/pipelines"><p:state>http://m
> arklogic.com/states/alerted</p:state></p:null-transition>
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> $action-to-execute =
> fn:doc("http://marklogic.com/cpf/pipelines/1728811395423663543
> 9.xml")/p:pipeline/p:success-action
> 2009-10-06 15:19:44.049 Notice: TaskServer: $e =
> <error:error
> xsi:schemaLocation="http://marklogic.com/xdmp/error
> error.xsd"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:error="http://marklogic.com/xdmp/error"><error:code>XDMP
> -TEXTNODE</error:code><error:name/><error:xquery...</error:error>
> 2009-10-06 15:19:44.049 Notice: TaskServer: $trace = ()
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> $failure-action =
> fn:doc("http://marklogic.com/cpf/pipelines/1728811395423663543
> 9.xml")/p:pipeline/p:failure-action
> 2009-10-06 15:19:44.049 Notice: TaskServer:
> $failure-module = "/ML/cpf/actions/failure-action.xqy"
> 2009-10-06 15:19:44.049 Notice: TaskServer: in
> /MarkLogic/cpf/triggers/on-state-enter.xqy, on line 40 [0.9-ml]
> 2009-10-06 15:19:44.049 Notice: TaskServer: $state =
> cpf:state("http://marklogic.com/states/alerted")
> 2009-10-06 15:19:44.049 Notice: TaskServer: $trace = ()
> 2009-10-06 15:19:44.049 Notice: TaskServer: $vars =
> (xs:QName("trgr:uri"), "/testfile.html",
> xs:QName("trgr:trigger"), ...)
>
>
> Please help us on this regards. Thanks in Advance.
>
> Regards,
> Selven Xavier .A
>
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://xqzone.marklogic.com/pipermail/general/attachments/2009
> 1006/65f21f85/attachment.html
>
> ------------------------------
>
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
>
>
> End of General Digest, Vol 64, Issue 11
> ***************************************
>
>
>
>
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general