org.xqdoc.conversion
Class XQDocController

java.lang.Object
  extended by org.xqdoc.conversion.XQDocController

public class XQDocController
extends java.lang.Object

This class is the mainline controller for processing library and main modules. Drivers for various XML database vendors would interact with this class to parse a module and use the generated XML to store into their database. The following would be the typical interactions with this class.

Version:
1.0
Author:
Darin McBeath

Field Summary
static java.lang.String APR2005
           
static java.lang.String COLLECTION
           
static java.lang.String JAN2007
           
static java.lang.String MAY2003
           
static java.lang.String NOV2003
           
static java.lang.String NOV2005
           
static java.lang.String OCT2004
           
static java.lang.String SEP2005
           
 
Constructor Summary
XQDocController(java.lang.String spec)
          Constructor.
 
Method Summary
 java.lang.String getDefaultFunctionNamespace()
          Return the default function namespace that should be used when parsing a library or main module.
 boolean getEncodeURIs()
          Return the encode document URI flag.
 java.lang.String getModuleBase()
          Return the module base.
 java.util.HashMap getPredefinedFunctionNamespaces()
          Return the predefined function namespaces that should be used when parsing a library or main module.
 org.xqdoc.conversion.XQDocPayload process(java.io.InputStream is, java.lang.String name)
          Process the library or main module identified by the InputStream.
 org.xqdoc.conversion.XQDocPayload process(java.io.Reader rdr, java.lang.String name)
          Process the library or main module identified by the Reader.
 void setDefaultFunctionNamespace(java.lang.String uri)
          Set the default function namespace that should be used when parsing a library or main module.
 void setEncodeURIs(boolean bool)
          Encoded document URIs.
 void setModuleBase(java.lang.String base)
          Set the module base to use for main modules.
 void setPredefinedFunctionNamespaces(java.util.HashMap map)
          Set any predefined function namespaces that should be used when parsing a library or main module.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAY2003

public static final java.lang.String MAY2003
See Also:
Constant Field Values

NOV2003

public static final java.lang.String NOV2003
See Also:
Constant Field Values

OCT2004

public static final java.lang.String OCT2004
See Also:
Constant Field Values

APR2005

public static final java.lang.String APR2005
See Also:
Constant Field Values

SEP2005

public static final java.lang.String SEP2005
See Also:
Constant Field Values

NOV2005

public static final java.lang.String NOV2005
See Also:
Constant Field Values

JAN2007

public static final java.lang.String JAN2007
See Also:
Constant Field Values

COLLECTION

public static final java.lang.String COLLECTION
See Also:
Constant Field Values
Constructor Detail

XQDocController

public XQDocController(java.lang.String spec)
                throws org.xqdoc.conversion.XQDocException
Constructor.

Parameters:
spec - The version of the W3C XQuery specification that should be used to parse the library and main modules. Valid values include the following: may2003, nov2003, oct2004, apr2005, sep2005, and nov2005.
Throws:
org.xqdoc.conversion.XQDocException
Method Detail

setPredefinedFunctionNamespaces

public void setPredefinedFunctionNamespaces(java.util.HashMap map)
Set any predefined function namespaces that should be used when parsing a library or main module. Many XQuery implementations support the concept of predefined namespaces (with a matching prefix) so they don't have to be repeated in the prolog section of library and main modules. Common predefined namespaces are the XPath F&O and proprietary vendor library modules. If a duplicate namespace prefix is specified in a library or main module, it will take precedence.

Parameters:
map - A mapping of namespace prefixes and namespace URIs.

getPredefinedFunctionNamespaces

public java.util.HashMap getPredefinedFunctionNamespaces()
Return the predefined function namespaces that should be used when parsing a library or main module.

Returns:
A mapping of namespace prefixes and namespace URIs.

setDefaultFunctionNamespace

public void setDefaultFunctionNamespace(java.lang.String uri)
Set the default function namespace that should be used when parsing a library or main module. Many XQuery implementations support the concept of predefined default namespace so it doesn't have to be repeated in the prolog section of library and modules. A common default function namespace is the XPath F&O . If a default function namespace is specified in a library or main module, it will take precedence.

Parameters:
uri - The uri for the default namespace.

getDefaultFunctionNamespace

public java.lang.String getDefaultFunctionNamespace()
Return the default function namespace that should be used when parsing a library or main module.

Returns:
The uri for the default namespace.

setModuleBase

public void setModuleBase(java.lang.String base)
Set the module base to use for main modules. This value is prepended to the name passed as the second parameter in the XQDocController process() and becomes the URI for storing the main module in the database.

Parameters:
base - The module base.

getModuleBase

public java.lang.String getModuleBase()
Return the module base.

Returns:
The module base

setEncodeURIs

public void setEncodeURIs(boolean bool)
Encoded document URIs. Currently, only a '/' is encoded. Some XML databases have problems if a document URI contains a '/'.

Parameters:
bool - flag to indicate whether URIs should be encoded

getEncodeURIs

public boolean getEncodeURIs()
Return the encode document URI flag.

Returns:
the encode flag

process

public org.xqdoc.conversion.XQDocPayload process(java.io.InputStream is,
                                                 java.lang.String name)
                                          throws org.xqdoc.conversion.XQDocException
Process the library or main module identified by the InputStream.

Parameters:
is - The input stream for the library or main module
name - The 'common name' for the library or main module
Returns:
Payload containing string of xqDoc XML and moduleURI
Throws:
org.xqdoc.conversion.XQDocException - Problems while parsing the module

process

public org.xqdoc.conversion.XQDocPayload process(java.io.Reader rdr,
                                                 java.lang.String name)
                                          throws org.xqdoc.conversion.XQDocException
Process the library or main module identified by the Reader.

Parameters:
rdr - The reader for the library or main module
name - The 'common name' for the library or main module
Returns:
Payload containing string of xqDoc XML and moduleURI
Throws:
org.xqdoc.conversion.XQDocException - Problems while parsing the module