Changes

Jump to navigation Jump to search
655 bytes added ,  20:31, 19 May 2013
XQuery: get-contents($x as xs:string)
Java : getContents(String x)
</pre>
 
Since {{Version|7.7}}, strings with invalid XML characters will be rejected by default. The validity check can be disabled by setting the [[Options#CHECKSTRINGS|CHECKSTRINGS]] option to false. The following query writes a file with a single 00-byte, which will then be successfully read via Java functions:
 
<pre class="brush:xquery">
declare namespace br = 'java.io.BufferedReader';
declare namespace fis = 'java.io.FileInputStream';
declare namespace isr = 'java.io.InputStreamReader';
 
declare option db:checkstrings 'false';
 
file:write-binary('00.bin', xs:hexBinary('00')),
br:new(isr:new(fis:new('00.bin'))) ! (br:readLine(.), br:close(.))
</pre>
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu