Inspection Module

This XQuery Module contains functions for extracting internal information about modules and functions and generating documentation.

=Conventions=

All functions and errors in this module are assigned to the  namespace, which is statically bound to the inspect prefix. xqDoc document instances are assigned to the  namespace, which is statically bound to the xqdoc prefix.

=Reflection=

inspect:static-context
=Documentation=

inspect:xqdoc
=Examples=

This is the sample.xqm library module:

 (:~ : This module provides some sample functions to demonstrate : the features of the Inspection Module. : : @author   BaseX Team : @see      http://docs.basex.org/wiki/XQDoc_Module : @version  1.0 :) module namespace samples = 'http://basex.org/modules/samples';

(:~ This is a sample string. :) declare variable $samples:test-string as xs:string := 'this is a string';

(:~ : This function simply returns the specified integer. : @param  $number number to return : @return  specified number :) declare %private function samples:same($number as xs:integer) as xs:integer { $number };

If inspect:module('sample.xqm') is run, the following output will be generated:

  This module provides some sample functions to demonstrate the features of the Inspection Module. BaseX Team http://docs.basex.org/wiki/XQDoc_Module 1.0   This is a sample string.  number to return  This function simply returns the specified integer. specified number

The output looks as follows if inspect:xqdoc('sample.xqm') is called:

   2013-06-01T16:59:33.654+02:00 1.1  <xqdoc:module type="library"> <xqdoc:uri>http://basex.org/modules/samples</xqdoc:uri> <xqdoc:name>sample.xqm</xqdoc:name> <xqdoc:comment> <xqdoc:description>This module provides some sample functions to demonstrate the features of the Inspection Module.</xqdoc:description> <xqdoc:author>BaseX Team</xqdoc:author> <xqdoc:see>http://docs.basex.org/wiki/XQDoc_Module</xqdoc:see> 1.0</xqdoc:version> </xqdoc:comment> </xqdoc:module> <xqdoc:namespaces> <xqdoc:namespace prefix="samples" uri="http://basex.org/modules/samples"/> </xqdoc:namespaces> <xqdoc:imports/> <xqdoc:variables> <xqdoc:variable> <xqdoc:name>samples:test-string</xqdoc:name> <xqdoc:comment> <xqdoc:description>This is a sample string.</xqdoc:description> </xqdoc:comment> <xqdoc:type>xs:string</xqdoc:type> </xqdoc:variable> </xqdoc:variables> <xqdoc:functions> <xqdoc:function arity="1"> <xqdoc:comment> <xqdoc:description>This function simply returns the specified integer.</xqdoc:description> <xqdoc:param>$number number to return</xqdoc:param> <xqdoc:return>specified number</xqdoc:return> </xqdoc:comment> <xqdoc:name>samples:same</xqdoc:name> <xqdoc:annotations> <xqdoc:annotation name="private"/> </xqdoc:annotations> <xqdoc:signature>declare %private function samples:same($number as xs:integer) as xs:integer</xqdoc:signature> <xqdoc:parameters> <xqdoc:parameter> <xqdoc:name>number</xqdoc:name> <xqdoc:type>xs:integer</xqdoc:type> </xqdoc:parameter> </xqdoc:parameters> <xqdoc:return> <xqdoc:type>xs:integer</xqdoc:type> </xqdoc:return> </xqdoc:function> </xqdoc:functions> </xqdoc:xqdoc>

=Errors=

=Changelog=


 * Version 9.3
 * Added: inspect:type


 * Version 8.5
 * Added: inspect:function-annotations, inspect:static-context
 * Updated: external attribute added to variables and functions
 * Updated: Relative URIs will always be resolved against the static base URI of the query


 * Version 7.9
 * Updated: a query URI can now be specified with inspect:functions.

This module was introduced with Version 7.7.