On 21/04/2011 16:00, Christian GrĂ¼n wrote:
This is how your XQuery snippet could look like:
<query xmlns="http://jax-rx.sourceforge.net"> <text><![CDATA[ insert node <snippet>to be inserted</snippet> into /updating/target ]]></text> </query>
Hope this helps, Christian
Will it work if I were to use serialized text instead of CDATA section, as in: <query xmlns="http://jax-rx.sourceforge.net"> <text>insert node <snippet>to be inserted</snippet> into /updating/target</text> </query>
will it work for the replace scenario as well, as in: <?xml version="1.0" encoding="iso-8859-1"?>jaxrx:query xmlns:jaxrx="http://jax-rx.sourceforge.net"<text> xquery version "1.0";
declare namespace fn="http://www.w3.org/2005/xpath-functions";
let $dataSet := 'Experimental' let $databaseName := 'MyData' let $applicationID := '1'
let $finalURL := fn:concat($databaseName, "/",$dataSet) let $applicationsModified := '<?xml version="1.0" encoding="iso-8859-1"?> <APPLICATION> <APPLICATION_ID>1</APPLICATION_ID> <DATA/> </APPLICATION>'
for $all in fn:collection($finalURL) for $anApp in $all/APPLICATION[APPLICATION_ID=$applicationID] return ( replace node $anApp with $applicationsModified ) </text></jaxrx:query>
If it wouldn't work, what would be the reason/s?
I am presently getting HTTP 500: <body><h2>HTTP ERROR 500</h2> <p>Problem accessing /basex/jax-rx. Reason: <pre> No enum const class org.jaxrx.core.QueryParameter.JAXRX:QUERY</pre></p><h3>Caused by:</h3><pre>java.lang.IllegalArgumentException: No enum const class org.jaxrx.core.QueryParameter.JAXRX:QUERY .at java.lang.Enum.valueOf(Enum.java:196) .at org.jaxrx.core.QueryParameter.valueOf(QueryParameter.java:1) .at org.jaxrx.resource.AResource.getParameters(AResource.java:165) .at org.jaxrx.resource.AResource.postQuery(AResource.java:281) .at org.jaxrx.resource.JaxRxResource.postQuery(JaxRxResource.java:1) .at org.jaxrx.resource.JaxRxResource.postQuery(JaxRxResource.java:109) .at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source) .at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)