org.basex.query.util.inspect
Class Inspect

java.lang.Object
  extended by org.basex.query.util.inspect.Inspect
Direct Known Subclasses:
PlainDoc, XQDoc

public abstract class Inspect
extends java.lang.Object

This class contains functions for inspecting XQuery modules and generating XQuery documentation.

Author:
BaseX Team 2005-13, BSD License, Christian Gruen

Field Summary
protected  QueryContext ctx
          Query context.
protected  InputInfo info
          Input info.
protected  StaticScope module
          Parsed main module.
 
Constructor Summary
protected Inspect(QueryContext qc, InputInfo ii)
          Constructor.
 
Method Summary
static void add(byte[] value, Context ctx, FElem elem)
          Parses a string as XML and adds the resulting nodes to the specified parent.
protected  void annotation(Ann ann, FElem parent, boolean uri)
          Creates annotation child elements.
protected  void comment(TokenObjMap<TokenList> tags, FElem parent)
          Creates a comment sub element.
static byte[] doc(TokenObjMap<TokenList> doc, byte[] name)
          Returns a value for the specified parameter, or null.
protected abstract  FElem elem(java.lang.String name, FElem parent)
          Creates an element.
abstract  FElem parse(IO io)
          Parses a module and returns an inspection element.
 QueryParser parseQuery(IO io)
          Parses a module.
protected abstract  FElem tag(byte[] tag, FElem parent)
          Creates a new element for the specified tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ctx

protected final QueryContext ctx
Query context.


info

protected final InputInfo info
Input info.


module

protected StaticScope module
Parsed main module.

Constructor Detail

Inspect

protected Inspect(QueryContext qc,
                  InputInfo ii)
Constructor.

Parameters:
qc - query context
ii - input info
Method Detail

parse

public abstract FElem parse(IO io)
                     throws QueryException
Parses a module and returns an inspection element.

Parameters:
io - input reference
Returns:
inspection element
Throws:
QueryException - query exception

parseQuery

public final QueryParser parseQuery(IO io)
                             throws QueryException
Parses a module.

Parameters:
io - input reference
Returns:
query parser
Throws:
QueryException - query exception

comment

protected final void comment(TokenObjMap<TokenList> tags,
                             FElem parent)
Creates a comment sub element.

Parameters:
tags - map with tags
parent - parent element

annotation

protected final void annotation(Ann ann,
                                FElem parent,
                                boolean uri)
                         throws QueryException
Creates annotation child elements.

Parameters:
ann - annotations
parent - parent element
uri - include uri
Throws:
QueryException - query exception

tag

protected abstract FElem tag(byte[] tag,
                             FElem parent)
Creates a new element for the specified tag.

Parameters:
tag - tag
parent - parent element
Returns:
element

elem

protected abstract FElem elem(java.lang.String name,
                              FElem parent)
Creates an element.

Parameters:
name - name of element
parent - parent element
Returns:
element node

add

public static void add(byte[] value,
                       Context ctx,
                       FElem elem)
Parses a string as XML and adds the resulting nodes to the specified parent.

Parameters:
ctx - database context
value - string to parse
elem - element

doc

public static byte[] doc(TokenObjMap<TokenList> doc,
                         byte[] name)
Returns a value for the specified parameter, or null.

Parameters:
doc - documentation
name - parameter name
Returns:
documentation of specified variable