|
API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.xml.xapi.XFactory
public abstract class XFactory
The XFactory
class is the main factory class for
creating executables for XPath, XQuery, and XSLT. It is also
the means for creating instances of other classes and factories
such as the XStaticContext
, XDynamicContext
,
XItemFactory
, and XSequenceTypeFactory
classes.
Use the newInstance
method to get a concrete
XFactory
object.
An instance of XFactory
maintains a set of registered
schemas and can be validating or non-validating. A validating
factory produces schema-aware executables and ensures that source
documents get validated against the set of registered schemas
before they are processed. If a source document includes a
schema location and that schema is not already registered
then it will be registered automatically when the source document
is processed. If different sets of stylesheets, queries or
expressions need different sets of schemas, these can be kept
separate by using more than one XFactory instance.
An instance of XFactory
is thread safe as long as
the settings remain stable.
Field Summary | |
---|---|
static int |
FULL_VALIDATION
Constant indicating that executables should be schema aware and input documents will be validated. |
static int |
NO_VALIDATION
Constant indicating that executables should not be schema aware and input documents will not be validated. |
Constructor Summary | |
---|---|
XFactory()
|
Method Summary | |
---|---|
abstract XCompilationFactory |
getCompilationFactory()
Get the compilation factory. |
abstract XItemFactory |
getItemFactory()
Get the item factory. |
abstract XMessageHandler |
getMessageHandler()
Get the message handler. |
abstract XSchemaResolver |
getSchemaResolver()
Get the currently registered schema resolver. |
abstract XSequenceTypeFactory |
getSequenceTypeFactory()
Get the sequence type factory. |
abstract Document |
getValidatedDOM(Document document)
Get a validated DOM. |
abstract Document |
getValidatedDOM(StreamSource source)
Get a validated DOM. |
abstract int |
getValidating()
Get the validation setting. |
static String |
getVersion()
Get the version of the XFactory . |
abstract XDynamicContext |
newDynamicContext()
Create a new XDynamicContext . |
static XFactory |
newInstance()
Create the default XFactory instance. |
abstract XOutputParameters |
newOutputParameters()
Create a new XOutputParameters . |
abstract XStaticContext |
newStaticContext()
Create a new XStaticContext . |
abstract XPathExecutable |
prepareXPath(StreamSource expression)
Create an XPathExecutable for an XPath expression which can then
be used to apply that expression to input documents. |
abstract XPathExecutable |
prepareXPath(StreamSource expression,
XStaticContext context)
Create an XPathExecutable for an XPath expression which can then
be used to apply that expression to input documents. |
abstract XPathExecutable |
prepareXPath(String expression)
Create an XPathExecutable for an XPath expression which can then
be used to apply that expression to input documents. |
abstract XPathExecutable |
prepareXPath(String expression,
XStaticContext context)
Create an XPathExecutable for an XPath expression which can then
be used to apply that expression to input documents. |
abstract XQueryExecutable |
prepareXQuery(StreamSource query)
Create an XQueryExecutable for an XQuery expression which can then
be used to apply that expression to input documents. |
abstract XQueryExecutable |
prepareXQuery(StreamSource query,
XStaticContext context)
Create an XQueryExecutable for an XQuery expression which can then
be used to apply that expression to input documents. |
abstract XQueryExecutable |
prepareXQuery(String query)
Create an XQueryExecutable for an XQuery expression which can then
be used to apply that expression to input documents. |
abstract XQueryExecutable |
prepareXQuery(String query,
XStaticContext context)
Create an XQueryExecutable for an XQuery expression which can then
be used to apply that expression to input documents. |
abstract XSLTExecutable |
prepareXSLT(Source stylesheet)
Create an XSLTransformExecutable for an XSL stylesheet which can then
be used to apply that stylesheet to input documents. |
abstract XSLTExecutable |
prepareXSLT(Source stylesheet,
XStaticContext context)
Create an XSLTransformExecutable for an XSL stylesheet which can then
be used to apply that stylesheet to input documents. |
abstract void |
registerSchema(Source source)
Register a schema. |
abstract void |
registerSchemas(List<? extends Source> schemas)
Register a list of schemas. |
abstract void |
setMessageHandler(XMessageHandler handler)
Set the message handler to be used when registering schemas, creating new items and sequences, and preparing and executing expressions, queries and stylesheets. |
abstract void |
setSchemaResolver(XSchemaResolver resolver)
Set the schema resolver to be used for imports in schemas registered using the registerSchema method or
for schemas imported in XSLT using the xsl:import-schema
declaration. |
abstract void |
setValidating(int value)
When full validation is enabled the factory will create validating executables and the input document will be validated on execution. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NO_VALIDATION
setValidating(int)
,
Constant Field Valuespublic static final int FULL_VALIDATION
setValidating(int)
,
Constant Field ValuesConstructor Detail |
---|
public XFactory()
Method Detail |
---|
public static XFactory newInstance() throws ClassNotFoundException, IllegalAccessException, InstantiationException
XFactory
instance.
XFactory
instance.
ClassNotFoundException
- if the class cannot be found.
IllegalAccessException
- if the class is not accessible.
InstantiationException
- if the class cannot be instantiated.public static String getVersion()
XFactory
. Use this method to
determine what features are available.
public abstract XPathExecutable prepareXPath(String expression)
XPathExecutable
for an XPath expression which can then
be used to apply that expression to input documents. The default static context
settings are used.
expression
- The XPath expression as a String
.
NullPointerException
- if the expression is null.
XProcessException
- if the prepare fails because of errors in the expression.public abstract XPathExecutable prepareXPath(String expression, XStaticContext context)
XPathExecutable
for an XPath expression which can then
be used to apply that expression to input documents.
expression
- The XPath expression as a String
.context
- The static context.
NullPointerException
- if the expression is null.
XProcessException
- if the prepare fails because of errors in the expression.public abstract XPathExecutable prepareXPath(StreamSource expression)
XPathExecutable
for an XPath expression which can then
be used to apply that expression to input documents. The default static context
settings are used.
expression
- The XPath expression as a StreamSource
.
NullPointerException
- if the expression is null.
XProcessException
- if the prepare fails because of errors in the expression.public abstract XPathExecutable prepareXPath(StreamSource expression, XStaticContext context)
XPathExecutable
for an XPath expression which can then
be used to apply that expression to input documents.
expression
- The XPath expression as a StreamSource
.context
- The static context.
NullPointerException
- if the expression is null.
XProcessException
- if the prepare fails because of errors in the expression.public abstract XQueryExecutable prepareXQuery(String query)
XQueryExecutable
for an XQuery expression which can then
be used to apply that expression to input documents. The default static context
settings are used.
query
- The XQuery expression as an String
.
NullPointerException
- if the query is null.
XProcessException
- if the prepare fails because of errors in the query.public abstract XQueryExecutable prepareXQuery(String query, XStaticContext context)
XQueryExecutable
for an XQuery expression which can then
be used to apply that expression to input documents.
query
- The XQuery expression as a String
.context
- The static context.
NullPointerException
- if the query is null.
XProcessException
- if the prepare fails because of errors in the query.public abstract XQueryExecutable prepareXQuery(StreamSource query)
XQueryExecutable
for an XQuery expression which can then
be used to apply that expression to input documents. The default static context
settings are used.
query
- The XQuery expression as a StreamSource
.
NullPointerException
- if the query is null.
XProcessException
- if the prepare fails because of errors in the query.public abstract XQueryExecutable prepareXQuery(StreamSource query, XStaticContext context)
XQueryExecutable
for an XQuery expression which can then
be used to apply that expression to input documents.
query
- The XQuery expression as a StreamSource
.context
- The static context.
NullPointerException
- if the query is null.
XProcessException
- if the prepare fails because of errors in the query.public abstract XSLTExecutable prepareXSLT(Source stylesheet)
XSLTransformExecutable
for an XSL stylesheet which can then
be used to apply that stylesheet to input documents. The default static context
settings are used.
stylesheet
- The XSL stylesheet as a Source
object.
NullPointerException
- if the stylesheet is null.
XProcessException
- if the prepare fails because of errors in the stylesheet.public abstract XSLTExecutable prepareXSLT(Source stylesheet, XStaticContext context)
XSLTransformExecutable
for an XSL stylesheet which can then
be used to apply that stylesheet to input documents.
stylesheet
- The XSL stylesheet as a Source
object.context
- The static context.
NullPointerException
- if the stylesheet is null.
XProcessException
- if the prepare fails because of errors in the stylesheet.public abstract XStaticContext newStaticContext()
XStaticContext
.
XStaticContext
object.public abstract XDynamicContext newDynamicContext()
XDynamicContext
.
XDynamicContext
object.public abstract void setValidating(int value)
NO_VALIDATION
.
value
- Set to FULL_VALIDATION
for full schema
validation, NO_VALIDATION
for no schema validation.registerSchema(Source)
,
FULL_VALIDATION
,
NO_VALIDATION
public abstract int getValidating()
public abstract void registerSchema(Source source)
Source
types are:
StreamSource
SAXSource
DOMSource
StAXSource
source
- The schema to register.
NullPointerException
- if the source is null.#setValidating(boolean)
public abstract void registerSchemas(List<? extends Source> schemas)
Source
types are:
StreamSource
SAXSource
DOMSource
StAXSource
schemas
- A list of schemas to register.
NullPointerException
- if the list is null.#setValidating(boolean)
public abstract void setSchemaResolver(XSchemaResolver resolver)
Set the schema resolver to be used for imports in schemas
registered using the registerSchema
method or
for schemas imported in XSLT using the xsl:import-schema
declaration.
The default behaviour for resolving imports within a schema is to use the
base URI of the schema to resolve the imported schema's location. The default
behaviour for XSLT schema imports is to use the base URI of the xsl:import-schema
declaration to resolve the location specified in the declaration.
resolver
- The schema resolver implementation or null
to revert to the default schema resolution behaviour.public abstract XSchemaResolver getSchemaResolver()
public abstract XItemFactory getItemFactory()
There is a direct association between an item factory
and an XFactory
instance since the item
factory depends on the registered schemas and whether
validating is enabled when processing
Source
objects. New schemas registered
using the registerSchema
method will
be visible by the item factory.
public abstract XSequenceTypeFactory getSequenceTypeFactory()
There is a direct association between a sequence type factory
and an XFactory
instance since the sequence type
factory depends on the registered schemas. New schemas
registered using the registerSchema
method will
be visible by the sequence type factory.
public abstract XCompilationFactory getCompilationFactory()
There is a direct association between a compilation factory
and an XFactory
instance since the compilation
factory depends on the registered schemas and whether
validating is enabled when generating compiled executables.
New schemas registered
using the registerSchema
method will
be visible by the compilation factory.
public abstract XOutputParameters newOutputParameters()
XOutputParameters
.
XOutputParameters
object.public abstract Document getValidatedDOM(StreamSource source)
registerSchema
method prior to calling this
method.
source
- The source.
Document
.registerSchema(Source)
public abstract Document getValidatedDOM(Document document)
registerSchema
method prior to calling this
method.
Document
- The document.
Document
.registerSchema(Source)
public abstract void setMessageHandler(XMessageHandler handler)
handler
- The message handler. Pass in null
to
restore the default message handling behaviour.XStaticContext.setMessageHandler(XMessageHandler)
,
XDynamicContext.setMessageHandler(XMessageHandler)
public abstract XMessageHandler getMessageHandler()
null
if not set.
|
IBM Copyright 2004-2008 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |