Changes

Jump to navigation Jump to search
44 bytes removed ,  18:24, 28 January 2012
no edit summary
It shows how to call Java code from XQuery.
The Java Binding [[Querying|query]] feature is an extensibility mechanism which allowsenables developersdirect calling of to directly access Java methods bound as variables and execute code from XQuery functions and manipulation of wrapped. Java classes are identified byJava objects. For using namespaces; the Java Binding feature, namespace URI must be of the user needs [[User_Managementform {{Mono|admin rights]]java:fully.qualified.ClassName}}.
Please note that the namespace URI must be of the form <code>java:fullyQualifiedClassName</code>. The following examples introduce the behavior. This example uses the java Java’s <code>Math</code> class and returns the cosine of an angle:
<pre class="brush:xquery">declare namespace math = "java:java.lang.Math";
math:cos(xs:double(0))
</pre>
'''Please Note''': To directly call a method directly it has to be set as <code>'''static'''</code> in your java code.
The next example writes 256 bytes to the file <code>output.txt</code>.
as Java code cannot be pre-compiled by BaseX, and will most probably be evaluated
slower than pure XQuery code.
Next, [[User_Management|admin permissions]] are required to execute Java code.
[[Category:XQuery]]
[[Category:API]]
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu