Hi David,
Thank you for your response.

I moved my script to a http-server on a separate portnummer
I call the script from a dosbox using cURL

curl http://145.43.181.76:8558/test.xqy (test.xqy attached)

The output is: test.xml (attachted)

The xdmp:save option <cdata-section-elements>rules</cdata-section-elements> is 
used to force values
Of element <rules> to be wrapping in <[!CDATA[-fields

See test.xml to observe that values of <rules>-element are not wrapped in 
<![CDATA[-fields, regardless of whether or not <![DATA[ was present in de 
elements in de .xqy.

<rules type="LINGUISTICS"><![CDATA[rule 1]]></rules> gets saved as <rules 
type="LINGUISTICS">rule 1</rules>

So, I'm not using the browser anymore, for either posting the request, or 
fetching the results.
But <![CDATA[-fields are not exported the way I was expected.

Kind regards
                Edgar Schouten

Van: [email protected] 
[mailto:[email protected]] Namens David Lee
Verzonden: dinsdag 20 oktober 2015 16:47
Aan: MarkLogic Developer Discussion <[email protected]>
CC: Moolen, Hubert G.M. van der (RB-NL) <[email protected]>
Onderwerp: Re: [MarkLogic Dev General] cdata-section-elements option doesn't 
produce CDATA-values

re: Apps folder that I run through the browser 
(http://localhost:8000/export.xqy )

Could you post that xquery and instead of using a brower use curl or some other 
direct HTTP method ?
It should not require 'post processing'

-----------------------------------------------------------------------------
David Lee
Lead Engineer
MarkLogic Corporation
[email protected]<mailto:[email protected]>
Phone: +1 812-482-5224
Cell:  +1 812-630-7622
www.marklogic.com<http://www.marklogic.com/>

From: 
[email protected]<mailto:[email protected]>
 [mailto:[email protected]] On Behalf Of Schouten, Edgar 
J. (RB-NL)
Sent: Tuesday, October 20, 2015 10:28 AM
To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Cc: Moolen, Hubert G.M. van der (RB-NL) 
<[email protected]<mailto:[email protected]>>
Subject: Re: [MarkLogic Dev General] cdata-section-elements option doesn't 
produce CDATA-values


Hi Florent



Thanks for your reply.



I can temporarily bypass the problem by manually changing replacing 'fake' 
<CDATA>-fields by <![CDATA[-fields as a post-proces.

The import in the application works fine after the replacement.



I've put a output.xqy file in my Marklogic-Apps folder that I run through the 
browser (http://localhost:8000/export.xqy )



The file basicly creates a node and saves it (simplified). I added the 
cdata-section-element also to the options of xdmp:save.



xquery version "1.0-ml";

declare option xdmp:output "cdata-section-elements=rules";



let $myVart := 1

return

     xdmp:save

     (

          "C:\LocalDisk\test.xml",

          <TeragramDirectoryStructureV3>

               <myElement>{$myVar}</myElement>

          </TeragramDirectoryStructureV3>,

          <options xmlns="xdmp:save">

                <output-encoding>utf-8</output-encoding>

               <cdata-section-elements>myElement</cdata-section-elements>

          </options>

     )





-----Oorspronkelijk bericht-----

Van: 
[email protected]<mailto:[email protected]>
 [mailto:[email protected]] Namens Florent Georges

Verzonden: dinsdag 20 oktober 2015 16:10

Aan: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>

Onderwerp: Re: [MarkLogic Dev General] cdata-section-elements option doesn't 
produce CDATA-values



On 20 October 2015 at 15:45, Schouten, Edgar J. (RB-NL) wrote:



  Hi,



> This application requires <![CDATA[-fields



  Which means it is not expecting XML.  CDATA is syntactic sugar.

Whether it is used or not, equivalent XML documents should be treated the same 
(regardless of CDATA sections).  Not everything has to be XML, so it might be 
OK, but often "issues" with CDATA are an application configured the wrong way 
and rejecting well-formed XML when it should not.



> declare option xdmp:output "cdata-section-elements=myElement";



  This can be applied only if the serializer gets into play.  How are you 
evaluating the query, and how are you saving (or displaying) its result?



  Regards,



--

Florent Georges

http://fgeorges.org/

http://h2oconsulting.be/

_______________________________________________

General mailing list

[email protected]<mailto:[email protected]>

Manage your subscription at:

http://developer.marklogic.com/mailman/listinfo/general

Attachment: test.xml
Description: test.xml

Attachment: test.xqy
Description: test.xqy

_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to