|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.xqj.Closable net.sf.saxon.xqj.SaxonXQDataFactory
public abstract class SaxonXQDataFactory
Saxon implementation of the XQJ interface XQDataFactory. This is an abstract superclass for SaxonXQDataSource and SaxonXQConnection, both of which provide the factory methods in this interface.
For Javadoc specifications of the public methods in this class, see the XQJ documentation.
Constructor Summary | |
---|---|
SaxonXQDataFactory()
|
Method Summary | |
---|---|
javax.xml.xquery.XQItemType |
createAtomicType(int baseType)
Create an atomic item type object representing a particular built-in atomic type |
javax.xml.xquery.XQItemType |
createAtomicType(int baseType,
QName typename,
URI schemaURI)
See interface definition, and description of Saxon extensions below. |
javax.xml.xquery.XQItemType |
createAttributeType(QName nodename,
int basetype)
Creates a new XQItemType object representing the XQuery
attribute(nodename, basetype) type
with the given node name and base type. |
javax.xml.xquery.XQItemType |
createAttributeType(QName nodename,
int basetype,
QName typename,
URI schemaURI)
Creates a new XQItemType object representing the XQuery
attribute(nodename,basetype,typename,schemaURI) type,
with the given node name, base type, schema type name and schema URI. |
javax.xml.xquery.XQItemType |
createCommentType()
Creates a new XQItemType object representing the XQuery
comment() type. |
javax.xml.xquery.XQItemType |
createDocumentElementType(javax.xml.xquery.XQItemType elementType)
Creates a new XQItemType object representing the XQuery
document-node(elementType) type containing a single element. |
javax.xml.xquery.XQItemType |
createDocumentSchemaElementType(javax.xml.xquery.XQItemType type)
Creates a new XQItemType object representing the XQuery
document-node(elementType) type containing a single
schema-element(...) . |
javax.xml.xquery.XQItemType |
createDocumentType()
Creates a new XQItemType object representing the XQuery
document-node() type. |
javax.xml.xquery.XQItemType |
createElementType(QName nodename,
int basetype)
Creates a new XQItemType object representing the XQuery
element(nodename, basetype) type, with the
given node name and base type. |
javax.xml.xquery.XQItemType |
createElementType(QName nodename,
int basetype,
QName typename,
URI schemaURI,
boolean allowNill)
Creates a new XQItemType object representing the XQuery
element(nodename,basetype,typename,schemaURI,
allowNill) type, given the node name, base type, schema type
name, schema URI, and nilled check. |
javax.xml.xquery.XQItem |
createItem(javax.xml.xquery.XQItem item)
Creates a copy of the specified XQItem . |
javax.xml.xquery.XQItem |
createItemFromAtomicValue(String value,
javax.xml.xquery.XQItemType type)
Creates an item from a given value. |
javax.xml.xquery.XQItem |
createItemFromBoolean(boolean value,
javax.xml.xquery.XQItemType type)
Creates an item from a given value. |
javax.xml.xquery.XQItem |
createItemFromByte(byte value,
javax.xml.xquery.XQItemType type)
Creates an item from a given value. |
javax.xml.xquery.XQItem |
createItemFromDocument(InputStream value,
String baseURI,
javax.xml.xquery.XQItemType type)
Creates an item from the given value. |
javax.xml.xquery.XQItem |
createItemFromDocument(Reader value,
String baseURI,
javax.xml.xquery.XQItemType type)
Creates an item from the given value. |
javax.xml.xquery.XQItem |
createItemFromDocument(Source value,
javax.xml.xquery.XQItemType type)
Creates an item from the given Source . |
javax.xml.xquery.XQItem |
createItemFromDocument(String value,
String baseURI,
javax.xml.xquery.XQItemType type)
Creates an item from the given value. |
javax.xml.xquery.XQItem |
createItemFromDocument(javax.xml.stream.XMLStreamReader value,
javax.xml.xquery.XQItemType type)
Creates an item from the given value. |
javax.xml.xquery.XQItem |
createItemFromDouble(double value,
javax.xml.xquery.XQItemType type)
Creates an item from a given value. |
javax.xml.xquery.XQItem |
createItemFromFloat(float value,
javax.xml.xquery.XQItemType type)
Creates an item from a given value. |
javax.xml.xquery.XQItem |
createItemFromInt(int value,
javax.xml.xquery.XQItemType type)
Creates an item from a given value. |
javax.xml.xquery.XQItem |
createItemFromLong(long value,
javax.xml.xquery.XQItemType type)
Creates an item from a given value. |
javax.xml.xquery.XQItem |
createItemFromNode(Node value,
javax.xml.xquery.XQItemType type)
Creates an item from a given value. |
javax.xml.xquery.XQItem |
createItemFromObject(Object value,
javax.xml.xquery.XQItemType type)
Creates an item from a given value. |
javax.xml.xquery.XQItem |
createItemFromShort(short value,
javax.xml.xquery.XQItemType type)
Creates an item from a given value. |
javax.xml.xquery.XQItem |
createItemFromString(String value,
javax.xml.xquery.XQItemType type)
Creates an item from a given value. |
javax.xml.xquery.XQItemType |
createItemType()
Creates a new XQItemType object representing the XQuery item type. |
javax.xml.xquery.XQItemType |
createNodeType()
Creates a new XQItemType object representing the XQuery node()
type. |
javax.xml.xquery.XQItemType |
createProcessingInstructionType(String piTarget)
Creates a new XQItemType object representing the XQuery
processing-instruction(piTarget) type. |
javax.xml.xquery.XQItemType |
createSchemaAttributeType(QName nodename,
int basetype,
URI schemaURI)
Creates a new XQItemType object representing the XQuery
schema-attribute(nodename,basetype,schemaURI) type,
with the given node name, base type, and schema URI. |
javax.xml.xquery.XQItemType |
createSchemaElementType(QName nodename,
int basetype,
URI schemaURI)
Creates a new XQItemType object representing the XQuery
schema-element(nodename,basetype,schemaURI)
type, given the node name, base type, and the schema URI. |
javax.xml.xquery.XQSequence |
createSequence(Iterator i)
Creates an XQSequence , containing all the items from the
iterator. |
javax.xml.xquery.XQSequence |
createSequence(javax.xml.xquery.XQSequence s)
Creates a copy of the specified XQSequence . |
javax.xml.xquery.XQSequenceType |
createSequenceType(javax.xml.xquery.XQItemType item,
int occurrence)
Creates a new sequence type from an item type and occurence indicator. |
javax.xml.xquery.XQItemType |
createTextType()
Creates a new XQItemType object representing the XQuery
text() type. |
ObjectConverter |
getObjectConverter()
Get the ObjectConverter in use. |
protected void |
init()
|
void |
setObjectConverter(ObjectConverter converter)
Set the ObjectConverter to be used. |
Methods inherited from class net.sf.saxon.xqj.Closable |
---|
close, isClosed, setClosableContainer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SaxonXQDataFactory()
Method Detail |
---|
protected void init()
public void setObjectConverter(ObjectConverter converter)
converter
- the user-supplied ObjectConverterpublic ObjectConverter getObjectConverter()
public javax.xml.xquery.XQItemType createAtomicType(int baseType) throws javax.xml.xquery.XQException
createAtomicType
in interface javax.xml.xquery.XQDataFactory
baseType
- the built-in atomic type, typically a constant such as
XQItemType.XQBASETYPE_BOOLEAN
javax.xml.xquery.XQException
- if the supplied baseType parameter is not an atomic typepublic javax.xml.xquery.XQItemType createAtomicType(int baseType, QName typename, URI schemaURI) throws javax.xml.xquery.XQException
In addition to the actions described in the XQJ interface definitions, Saxon allows the
typename to be a name representing a Java external type. In this case the URI part of the QName
must be NamespaceConstant.JAVA_TYPE
, and the local part of the name must be the Java class
name (qualified with its package name)
createAtomicType
in interface javax.xml.xquery.XQDataFactory
baseType
- the "baseType" (in XQJ terminology)typename
- the qualified name of the typeschemaURI
- the location of a schema document in which the type is defined (may be null)
javax.xml.xquery.XQException
public javax.xml.xquery.XQItemType createAttributeType(QName nodename, int basetype) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQItemType
object representing the XQuery
attribute(nodename, basetype)
type
with the given node name and base type. This method can be used to create
item type for attributes with a pre-defined schema type.
XQConnection conn = ..; // An XQuery connection - attribute() // no node name, pass null for the node name conn.createAttributeType(null, XQItemType.XQBASETYPE_ANYSIMPLETYPE); - attribute (*) // equivalent to attribute() conn.createAttributeType(null, XQItemType.XQBASETYPE_ANYSIMPLETYPE); - attribute (person) // attribute of name person and any simple type. conn.createAttributeType(new QName("person"), XQItemType.XQBASETYPE_ANYSIMPLETYPE); - attribute(foo:bar) // node name foo:bar, type is any simple type conn.createAttributeType(new QName("http://www.foo.com", "bar","foo"), XQItemType.XQBASETYPE_ANYSIMPLETYPE); - attribute(foo:bar, xs:integer) // node name foo:bar, type is xs:integer conn.createAttributeType(new QName("http://www.foo.com", "bar","foo"), XQItemType.XQBASETYPE_INTEGER);
createAttributeType
in interface javax.xml.xquery.XQDataFactory
nodename
- specifies the name of the node.null
indicates a wildcard for the node namebasetype
- the base type of the attribute. One of the
XQItemType.XQBASETYPE_*
other than XQItemType.XQBASETYPE_UNTYPED
or XQItemType.XQBASETYPE_ANYTYPE
XQItemType
representing the XQuery
attribute(nodename, basetype)
type
javax.xml.xquery.XQException
- if (1) the underlying object implementing the interface is closed or
(2) if the base type is one of:
XQItemType.XQBASETYPE_UNTYPED
or XQItemType.XQBASETYPE_ANYTYPE
public javax.xml.xquery.XQItemType createAttributeType(QName nodename, int basetype, QName typename, URI schemaURI) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQItemType
object representing the XQuery
attribute(nodename,basetype,typename,schemaURI)
type,
with the given node name, base type, schema type name and schema URI. The type name can
reference either pre-defined simple types or user-defined simple types.
XQConnection conn = ..; // An XQuery connection - attribute (name, employeename) // attribute name of type employeename conn.createAttributeType(new QName("name"), XQItemType.XQBASETYPE_ANYSIMPLETYPE, new QName("employeename"), null); - attribute (foo:bar, po:city) where the prefix foo refers to the namespace http://www.foo.com and the prefix po refers to the namespace "http://www.address.com" conn.createAttributeType(new QName("http://www.foo.com", "bar","foo"), XQItemType.XQBASETYPE_ANYSIMPLETYPE, new QName("http://address.com", "address","po"), null); - attribute (zip, zipcode) // attribute zip of type zipchode which derives from // xs:string conn.createAttributeType(new QName("zip"), XQItemType.XQBASETYPE_STRING, new QName("zipcode"), null); - attribute(foo:bar, po:hatsize) where the prefix foo refers to the namespace http://www.foo.com and the prefix po refers to the namespace "http://www.hatsizes.com" with schema URI "http://hatschema.com" conn.createAttributeType(new QName("http://www.foo.com", "bar","foo"), XQItemType.XQBASETYPE_INTEGER, new QName("http://www.hatsizes.com", "hatsize","po"), new QName("http://hatschema.com"));
createAttributeType
in interface javax.xml.xquery.XQDataFactory
nodename
- specifies the name of the node.null
indicates a wildcard for the node namebasetype
- the base type of the attribute. One of the
XQItemTyupe.XQBASETYPE_*
constants
other than XQItemType.XQBASETYPE_UNTYPED
or
XQItemType.XQBASETYPE_ANYTYPE
typename
- the QName
of the type. If the QName
refers to a predefinied type, it must match
the basetype
. Can be null
.schemaURI
- the URI to the schema. Can be null
. This can
only be specified if the typename is also specified
XQItemType
representing the XQuery
attribute(nodename,basetype,
typename,schemaURI)
type.
javax.xml.xquery.XQException
- if (1) the underlying object implementing the interface is closed,
(2) if the base type is one of:
XQItemType.XQBASETYPE_UNTYPED
or
XQItemType.XQBASETYPE_ANYTYPE
,
(3) the schema URI is specified and the typename
is not specified, (4) the implementation does
not support user-defined XML schema types, or (5)
if the typename
refers to a predefinied
type and does not match basetype
public javax.xml.xquery.XQItemType createCommentType() throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQItemType
object representing the XQuery
comment()
type. The XQItemType
object will have
the item kind set to XQItemType.XQITEMKIND_COMMENT
.
XQConnection conn = ..; // An XQuery connection XQItemType cmttype = conn.createCommentType(); int itemkind = cmttype.getItemKind(); // will be XQItemType.XQITEMKIND_COMMENT XQExpression expr = conn.createExpression(); XQSequence result = expr.executeQuery("<!-- comments -->"); result.next(); boolean pi = result.instanceOf(cmttype); // will be true
createCommentType
in interface javax.xml.xquery.XQDataFactory
XQItemType
representing the XQuery
comment()
type
javax.xml.xquery.XQException
- if the underlying object implementing the interface is closedpublic javax.xml.xquery.XQItemType createDocumentElementType(javax.xml.xquery.XQItemType elementType) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQItemType
object representing the XQuery
document-node(elementType)
type containing a single element.
The XQItemType
object will have the item kind set to
XQItemType.XQITEMKIND_DOCUMENT_ELEMENT
and the
base type set to the item type of the input elementType
.
createDocumentElementType
in interface javax.xml.xquery.XQDataFactory
elementType
- an XQItemType
object representing an XQuery
element()
type, cannot be null
XQItemType
representing the XQuery
document-node(elementType)
type containing
a single element
javax.xml.xquery.XQException
- if (1) the underlying object implementing the interface is
closed or (2) the elementType
has an item kind
different from XQItemType.XQITEMKIND_ELEMENT
,
(3) the elementType
argument is null
,
or (4) the implementation does not support user-defined XML
schema typespublic javax.xml.xquery.XQItemType createDocumentSchemaElementType(javax.xml.xquery.XQItemType type) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQItemType
object representing the XQuery
document-node(elementType)
type containing a single
schema-element(...)
. The XQItemType
object will
have the item kind set to XQItemType.XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT
and the
base type set to the item type of the input elementType
.
createDocumentSchemaElementType
in interface javax.xml.xquery.XQDataFactory
type
- an XQItemType
object representing an XQuery
schema-element(...)
type, cannot be null
XQItemType
representing the XQuery
document-node(elementType)
type containing
a single schema-element(...)
element
javax.xml.xquery.XQException
- if (1) the underlying object implementing the interface is
closed or (2) the elementType
has an item kind
different from XQItemType.XQITEMKIND_SCHEMA_ELEMENT
,
(3) the elementType
argument is null
,
(4) the implementation does not support user-defined XML
schema typespublic javax.xml.xquery.XQItemType createDocumentType() throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQItemType
object representing the XQuery
document-node()
type. The XQItemType
object will have the item kind
set to XQItemType.XQITEMKIND_DOCUMENT
.
createDocumentType
in interface javax.xml.xquery.XQDataFactory
XQItemType
representing the XQuery
document-node()
type
javax.xml.xquery.XQException
- if the underlying object implementing the interface is closedpublic javax.xml.xquery.XQItemType createElementType(QName nodename, int basetype) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQItemType
object representing the XQuery
element(nodename, basetype)
type, with the
given node name and base type. This method can be used to create item
type for elements with a pre-defined schema type.
XQConnection conn = ..; // An XQuery connection - element() // no node name, pass null for the node name conn.createElementType(null, XQItemType.XQBASETYPE_ANYTYPE); - element (*) // equivalent to element() conn.createElementType(null, XQItemType.XQBASETYPE_ANYTYPE); - element(person) // element of name person and any type. conn.createElementType(new QName("person"), XQItemType.XQBASETYPE_ANYTYPE); - element(foo:bar) // node name foo:bar, type is anytype conn.createElementType(new QName("http://www.foo.com", "bar","foo"), XQItemType.XQBASETYPE_ANYTYPE); - element(foo:bar, xs:integer) // node name foo:bar, type is xs:integer conn.createElementType(new QName("http://www.foo.com", "bar","foo"), XQItemType.XQBASETYPE_INTEGER);
createElementType
in interface javax.xml.xquery.XQDataFactory
nodename
- specifies the name of the node. null
indicates a wildcard for the node namebasetype
- the base type of the item. One of the
XQItemType.XQBASETYPE_*
constants
XQItemType
representing the XQuery
element(nodename, basetype)
type
javax.xml.xquery.XQException
- if (1) the underlying object implementing the interface
is closedpublic javax.xml.xquery.XQItemType createElementType(QName nodename, int basetype, QName typename, URI schemaURI, boolean allowNill) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQItemType
object representing the XQuery
element(nodename,basetype,typename,schemaURI,
allowNill)
type, given the node name, base type, schema type
name, schema URI, and nilled check. The type name can reference either pre-defined
schema types or user-defined types.
XQConnection conn = ..; // An XQuery connection - element (person, employee) // element person of type employee conn.createElementType(new QName("person"), XQItemType.XQBASETYPE_ANYTYPE, new QName("employee"), null ,false); - element(person, employee ? ) // element person of type employee, whose nilled // property may be true or false. conn.createElementType(new QName("person"), XQItemType.XQBASETYPE_ANYTYPE, new QName("employee"), null ,true); - element(foo:bar, po:address) where the prefix foo refers to the namespace http://www.foo.com and the prefix po refers to the namespace "http://www.address.com" conn.createElementType(new QName("http://www.foo.com", "bar","foo"), XQItemType.XQBASETYPE_ANYTYPE, new QName("http://address.com", "address","po"), null, false); - element (zip, zipcode) // element zip of type zipchode which derives from // xs:string conn.createElementType(new QName("zip"), XQItemType.XQBASETYPE_STRING, new QName("zipcode"), null, false); - element (*, xs:anyType ?) conn.createElementType(null, XQItemType.XQBASETYPE_ANYTYPE, null, null, true); - element(foo:bar, po:hatsize) where the prefix foo refers to the namespace http://www.foo.com and the prefix po refers to the namespace "http://www.hatsizes.com" with schema URI "http://hatschema.com" conn.createElementType(new QName("http://www.foo.com", "bar","foo"), XQItemType.XQBASETYPE_INTEGER, new QName("http://www.hatsizes.com", "hatsize","po"), new QName("http://hatschema.com"), false);
createElementType
in interface javax.xml.xquery.XQDataFactory
nodename
- specifies the name of the element. null
indicates a wildcard for the node namebasetype
- the base type of the item. One of the
XQItemType.XQBASETYPE_*
constantstypename
- the QName
of the type. If the QName
refers to a predefinied type, it must match
the basetype
. Can be null
schemaURI
- the URI to the schema. Can be null
. This can
only be specified if the typename is also specifiedallowNill
- the nilled property of the element
XQItemType
representing the XQuery
element(nodename,basetype,
typename,schemaURI,
allowNill)
type
javax.xml.xquery.XQException
- if (1) schemaURI is specified but the typename is not
specified, (2) the underlying object implementing the
interface is closed, (3) the implementation does
not support user-defined XML schema types, or
(4) if the typename
refers to a predefinied
type and does not match basetype
public javax.xml.xquery.XQItem createItem(javax.xml.xquery.XQItem item) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQItem
. This method can be used, for
example, to copy an XQResultItem
object so that the new item is not
dependant on the connection.
createItem
in interface javax.xml.xquery.XQDataFactory
item
- the XQItem
to copy
XQItem
independent of any underlying
XQConnection
is created
javax.xml.xquery.XQException
- if (1) the specified item is null
,
(2) the underlying object implementing the interface is
closed, (3) the specified item is closedpublic javax.xml.xquery.XQItem createItemFromAtomicValue(String value, javax.xml.xquery.XQItemType type) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
xs:string
rules outlined in
17.1.1 Casting from xs:string and xs:untypedAtomic, XQuery 1.0 and
XPath 2.0 Functions and Operators. If the cast fails
an XQException
is thrown.
createItemFromAtomicValue
in interface javax.xml.xquery.XQDataFactory
value
- the lexical string value of the typetype
- the item type
XQItem
representing the resulting item
javax.xml.xquery.XQException
- if (1) any of the arguments are null
,
(2) given type is not an atomic type,
(3) the conversion of the value to an XDM
instance failed, or (4) the underlying object
implementing the interface is closedpublic javax.xml.xquery.XQItem createItemFromBoolean(boolean value, javax.xml.xquery.XQItemType type) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQException
will be thrown.
createItemFromBoolean
in interface javax.xml.xquery.XQDataFactory
value
- the value to be convertedtype
- the type of the value to be bound to
the external variable. The default type of
the value is used in case null
is
specified
XQItem
representing the resulting item
javax.xml.xquery.XQException
- (1) the conversion of the value
to an XDM instance failed, or (2) the underlying object
implementing the interface is closedpublic javax.xml.xquery.XQItem createItemFromByte(byte value, javax.xml.xquery.XQItemType type) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQException
will be thrown.
createItemFromByte
in interface javax.xml.xquery.XQDataFactory
value
- the value to be convertedtype
- the type of the value to be bound to
the external variable. The default type of
the value is used in case null
is
specified
XQItem
representing the resulting item
javax.xml.xquery.XQException
- (1) the conversion of the value
to an XDM instance failed, or (2) the underlying object
implementing the interface is closedpublic javax.xml.xquery.XQItem createItemFromDocument(InputStream value, String baseURI, javax.xml.xquery.XQItemType type) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
null
,
XQITEMKIND_DOCUMENT_ELEMENT
, or
XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT
.
createItemFromDocument
in interface javax.xml.xquery.XQDataFactory
value
- the value to be converted, cannot be
null
baseURI
- an optional base URI, can be null
. It can
be used, for example, to resolve relative URIs and to
include in error messages.type
- the type of the value for the created
document node. If null
is specified,
it behaves as if
XQDataFactory.createDocumentElementType(
XQDataFactory.createElementType(null,
XQItemType.XQBASETYPE_XS_UNTYPED))
were passed in
as the type parameter. That is, the type represents the
XQuery sequence type document-node(element(*, xs:untyped))
XQItem
representing the resulting
item
javax.xml.xquery.XQException
- if (1) the value argument is null
,
(2) the conversion of the value to an XDM instance
failed, or (3) the underlying object
implementing the interface is closedpublic javax.xml.xquery.XQItem createItemFromDocument(Reader value, String baseURI, javax.xml.xquery.XQItemType type) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
null
,
XQITEMKIND_DOCUMENT_ELEMENT
, or
XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT
.
createItemFromDocument
in interface javax.xml.xquery.XQDataFactory
value
- the value to be converted, cannot be
null
baseURI
- an optional base URI, can be null
. It can
be used, for example, to resolve relative URIs and to
include in error messages.type
- the type of the value for the created
document node. If null
is specified,
it behaves as if
XQDataFactory.createDocumentElementType(
XQDataFactory.createElementType(null,
XQItemType.XQBASETYPE_XS_UNTYPED))
were passed in
as the type parameter. That is, the type represents the
XQuery sequence type document-node(element(*, xs:untyped))
XQItem
representing the resulting
item
javax.xml.xquery.XQException
- if (1) the value argument is null
,
(2) the conversion of the value to an XDM instance
failed, or (3) the underlying object
implementing the interface is closedpublic javax.xml.xquery.XQItem createItemFromDocument(Source value, javax.xml.xquery.XQItemType type) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
Source
. An XQJ
implementation must at least support the following implementations:
javax.xml.transform.dom.DOMSource
javax.xml.transform.sax.SAXSource
javax.xml.transform.stream.StreamSource
null
,
XQITEMKIND_DOCUMENT_ELEMENT
, or
XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT
.
createItemFromDocument
in interface javax.xml.xquery.XQDataFactory
value
- the value to be converted, cannot be null
type
- the type of the value for the created
document node. If null
is specified,
it behaves as if
XQDataFactory.createDocumentElementType(
XQDataFactory.createElementType(null,
XQItemType.XQBASETYPE_XS_UNTYPED))
were passed in
as the type parameter. That is, the type represents the
XQuery sequence type document-node(element(*, xs:untyped))
XQItem
representing the resulting
item
javax.xml.xquery.XQException
- if (1) the value argument is null
, (2)
the conversion of the value to an XDM instance failed,
or (3) the underlying object implementing the interface
is closedpublic javax.xml.xquery.XQItem createItemFromDocument(String value, String baseURI, javax.xml.xquery.XQItemType type) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
null
,
XQITEMKIND_DOCUMENT_ELEMENT
, or
XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT
.
createItemFromDocument
in interface javax.xml.xquery.XQDataFactory
value
- the value to be converted, cannot be
null
baseURI
- an optional base URI, can be null
. It can
be used, for example, to resolve relative URIs and to
include in error messages.type
- the type of the value for the created
document node. If null
is specified,
it behaves as if
XQDataFactory.createDocumentElementType(
XQDataFactory.createElementType(null,
XQItemType.XQBASETYPE_XS_UNTYPED))
were passed in
as the type parameter. That is, the type represents the
XQuery sequence type document-node(element(*, xs:untyped))
XQItem
representing the resulting
item
javax.xml.xquery.XQException
- if (1) the value argument is null
,
(2) the conversion of the value to an XDM instance
failed, or (3) the underlying object
implementing the interface is closedpublic javax.xml.xquery.XQItem createItemFromDocument(javax.xml.stream.XMLStreamReader value, javax.xml.xquery.XQItemType type) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
null
,
XQITEMKIND_DOCUMENT_ELEMENT
or XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT
.
createItemFromDocument
in interface javax.xml.xquery.XQDataFactory
value
- the value to be converted, cannot be null
type
- the type of the value for the created
document node. If null
is specified,
it behaves as if
XQDataFactory.createDocumentElementType(
XQDataFactory.createElementType(null,
XQItemType.XQBASETYPE_XS_UNTYPED))
were passed in
as the type parameter. That is, the type represents the
XQuery sequence type document-node(element(*, xs:untyped))
XQItem
representing the resulting
item
javax.xml.xquery.XQException
- if (1) the value argument is null
, (2)
the conversion of the value to an XDM instance failed,
or (3) the underlying object implementing the interface
is closedpublic javax.xml.xquery.XQItem createItemFromDouble(double value, javax.xml.xquery.XQItemType type) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQException
will be thrown.
createItemFromDouble
in interface javax.xml.xquery.XQDataFactory
value
- the value to be convertedtype
- the type of the value to be bound to
the external variable. The default type of
the value is used in case null
is
specified
XQItem
representing the resulting item
javax.xml.xquery.XQException
- (1) the conversion of the value
to an XDM instance failed, or (2) the underlying object
implementing the interface is closedpublic javax.xml.xquery.XQItem createItemFromFloat(float value, javax.xml.xquery.XQItemType type) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQException
will be thrown.
createItemFromFloat
in interface javax.xml.xquery.XQDataFactory
value
- the value to be convertedtype
- the type of the value to be bound to
the external variable. The default type of
the value is used in case null
is
specified
XQItem
representing the resulting item
javax.xml.xquery.XQException
- (1) the conversion of the value
to an XDM instance failed, or (2) the underlying object
implementing the interface is closedpublic javax.xml.xquery.XQItem createItemFromInt(int value, javax.xml.xquery.XQItemType type) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQException
will be thrown.
createItemFromInt
in interface javax.xml.xquery.XQDataFactory
value
- the value to be convertedtype
- the type of the value to be bound to
the external variable. The default type of
the value is used in case null
is
specified
XQItem
representing the resulting item
javax.xml.xquery.XQException
- (1) the conversion of the value
to an XDM instance failed, or (2) the underlying object
implementing the interface is closedpublic javax.xml.xquery.XQItem createItemFromLong(long value, javax.xml.xquery.XQItemType type) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQException
will be thrown.
createItemFromLong
in interface javax.xml.xquery.XQDataFactory
value
- the value to be convertedtype
- the type of the value to be bound to
the external variable. The default type of
the value is used in case null
is
specified
XQItem
representing the resulting item
javax.xml.xquery.XQException
- (1) the conversion of the value
to an XDM instance failed, or (2) the underlying object
implementing the interface is closedpublic javax.xml.xquery.XQItem createItemFromNode(Node value, javax.xml.xquery.XQItemType type) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQException
will be thrown.
createItemFromNode
in interface javax.xml.xquery.XQDataFactory
value
- the value to be converted, cannot be
null
type
- the type of the value to be bound to
the external variable. The default type of
the value is used in case null
is
specified
XQItem
representing the resulting item
javax.xml.xquery.XQException
- if (1) the value
argument is
null
, (2) the conversion of the value
to an XDM instance failed, or (3) the underlying object
implementing the interface is closedpublic javax.xml.xquery.XQItem createItemFromObject(Object value, javax.xml.xquery.XQItemType type) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQException
will be thrown.
createItemFromObject
in interface javax.xml.xquery.XQDataFactory
value
- the value to be converted, cannot be
null
type
- the type of the value to be bound to
the external variable. The default type of
the value is used in case null
is
specified
XQItem
representing the resulting item
javax.xml.xquery.XQException
- if (1) the value
argument is
null
, (2) the conversion of the value
to an XDM instance failed, or (3) the underlying object
implementing the interface is closedpublic javax.xml.xquery.XQItem createItemFromString(String value, javax.xml.xquery.XQItemType type) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
xs:string
or a type derived by restriction from
xs:string
. If the specified type is null
, it
defaults to xs:string
.XQException
will be thrown.
createItemFromString
in interface javax.xml.xquery.XQDataFactory
value
- the value to be converted, cannot be
null
type
- the type of the value to be bound to the
external variable. The default type,
xs:string
, is used in case
null
is specified
XQItem
representing the resulting
item
javax.xml.xquery.XQException
- if (1) the value
argument is
null
, (2) the conversion of the
value to an XDM instance failed, or (3) the
underlying object implementing the interface
is closedpublic javax.xml.xquery.XQItemType createItemType() throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQItemType
object representing the XQuery item type.
The XQItemType
object will have the item kind set to
XQItemType.XQITEMKIND_ITEM
.
XQConnection conn = ..; // An XQuery connection XQItemType typ = conn.createItemType(); // represents the XQuery item type "item()"
createItemType
in interface javax.xml.xquery.XQDataFactory
XQItemType
representing the XQuery
item type
javax.xml.xquery.XQException
- if the underlying object implementing the interface
is closedpublic javax.xml.xquery.XQItem createItemFromShort(short value, javax.xml.xquery.XQItemType type) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQException
will be thrown.
createItemFromShort
in interface javax.xml.xquery.XQDataFactory
value
- the value to be convertedtype
- the type of the value to be bound to
the external variable. The default type of
the value is used in case null
is
specified
XQItem
representing the resulting item
javax.xml.xquery.XQException
- (1) the conversion of the value
to an XDM instance failed, or (2) the underlying object
implementing the interface is closedpublic javax.xml.xquery.XQItemType createNodeType() throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQItemType
object representing the XQuery node()
type. The XQItemType
object will have the item kind set to
XQItemType.XQITEMKIND_NODE
.
createNodeType
in interface javax.xml.xquery.XQDataFactory
XQItemType
representing the
XQuery node()
type
javax.xml.xquery.XQException
- if the underlying object implementing the interface
is closedpublic javax.xml.xquery.XQItemType createProcessingInstructionType(String piTarget) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQItemType
object representing the XQuery
processing-instruction(piTarget)
type. The XQItemType
object
will have the item kind set to XQItemType.XQITEMKIND_PI
. A
string literal can be passed to match the PITarget of the processing instruction
as described in
2.5.4.2 Matching an Item Type and an Item, XQuery 1.0: An XML Query Language.
XQConnection conn = ..; // An XQuery connection XQItemType anypi = conn.createProcessingInstructionType(); XQItemType foopi = conn.createProcessingInstructionType("foo-format"); XQExpression expr = conn.createExpression(); XQSequence result = expr.executeQuery("<?format role="output" ?>"); result.next(); boolean pi = result.instanceOf(anypi); // will be true pi = result.instanceOf(foopi); // will be false XQExpression expr = conn.createExpression(); XQSequence result = expr.executeQuery("<?foo-format role="output" ?>"); result.next(); boolean pi = result.instanceOf(anypi); // will be true pi = result.instanceOf(foopi); // will be true
createProcessingInstructionType
in interface javax.xml.xquery.XQDataFactory
piTarget
- the string literal to match the processing
instruction's PITarget. A null
string
value will match all processing instruction nodes
XQItemType
representing the XQuery
processing-instruction(piTarget)
type
javax.xml.xquery.XQException
- if the underlying object implementing the interface is
closedpublic javax.xml.xquery.XQItemType createSchemaAttributeType(QName nodename, int basetype, URI schemaURI) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQItemType
object representing the XQuery
schema-attribute(nodename,basetype,schemaURI)
type,
with the given node name, base type, and schema URI.
XQConnection conn = ..; // An XQuery connection - schema-attribute (name) // schema-attribute name, found in the schema // available at http://customerschema.com conn.createSchemaAttributeType(new QName("name"), XQItemType.XQBASETYPE_STRING, new URI(http://customerschema.com));
createSchemaAttributeType
in interface javax.xml.xquery.XQDataFactory
nodename
- specifies the name of the nodebasetype
- the base type of the attribute. One of the
XQItemTyupe.XQBASETYPE_*
constants
other than XQItemType.XQBASETYPE_UNTYPED
or
XQItemType.XQBASETYPE_ANYTYPE
schemaURI
- the URI to the schema. Can be null
XQItemType
representing the XQuery
schema-attribute(nodename,basetype,
schemaURI)
type
javax.xml.xquery.XQException
- if (1) the node name is null
,
(2) if the base type is one of:
XQItemType.XQBASETYPE_UNTYPED
or
XQItemType.XQBASETYPE_ANYTYPE
,
(3) the underlying object implementing the interface
is closed, or (4) the implementation does
not support user-defined XML schema typespublic javax.xml.xquery.XQItemType createSchemaElementType(QName nodename, int basetype, URI schemaURI) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQItemType
object representing the XQuery
schema-element(nodename,basetype,schemaURI)
type, given the node name, base type, and the schema URI.
XQConnection conn = ..; // An XQuery connection - schema-element (customer) // schema-element person, found in // the schema available at http://customerschema.com conn.createElementType(new QName("customer"), XQItemType.XQBASETYPE_ANYTYPE, new URI("http://customerschema.com"));
createSchemaElementType
in interface javax.xml.xquery.XQDataFactory
nodename
- specifies the name of the elementbasetype
- the base type of the item. One of the
XQItemType.XQBASETYPE_*
constantsschemaURI
- the URI to the schema. Can be null
XQItemType
representing the XQuery
schema-element(nodename,basetype,
schemaURI)
type
javax.xml.xquery.XQException
- if (1) the node name is null
,
(2) the underlying object implementing the
interface is closed, or (3) the implementation does
not support user-defined XML schema typespublic javax.xml.xquery.XQSequence createSequence(Iterator i) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQSequence
, containing all the items from the
iterator. The newly created XQSequence
is scrollable and
independent of any underlying XQConnection
.
If the iterator returns an XQItem
, it is added to the
sequence. If the iterator returns any other object, an item is added to the
sequence following the rules from 14.2 Mapping a Java Data Type
to an XQuery Data Type, XQuery API for Java (XQJ) 1.0.
If the iterator does not return any items, then an empty sequence is created.
createSequence
in interface javax.xml.xquery.XQDataFactory
i
- input iterator
XQSequence
representing the sequence
containing all items from the input iterator
javax.xml.xquery.XQException
- if (1) the conversion of any of the objects in the
iterator to item fails, (2)
the i
parameter is null
,
or (3) underlying object implementing the interface
is closedpublic javax.xml.xquery.XQSequence createSequence(javax.xml.xquery.XQSequence s) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQSequence
. The newly created
XQSequence
is scrollable and independent of any underlying
XQConnection
. The new XQSequence
will contain all
items from the specified XQSequence
starting from its current
position. The copy process will implicitly perform next operations on the
specified sequence to read the items. All items are consumed, the current
position of the cursor is set to point after the last item.
createSequence
in interface javax.xml.xquery.XQDataFactory
s
- input sequence
XQSequence
representing a copy of
the input sequence
javax.xml.xquery.XQException
- if (1) there are errors accessing the items in
the specified sequence, (2) the specified sequence
is closed, (3) in the case of a forward only
sequence, a get or write method has already
been invoked on the current item, (4)
the s
parameter is null
,
or (5) the underlying object implementing the
interface is closedpublic javax.xml.xquery.XQSequenceType createSequenceType(javax.xml.xquery.XQItemType item, int occurrence) throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
createSequenceType
in interface javax.xml.xquery.XQDataFactory
item
- the item type. This parameter must be null
if
the occurance is XQSequenceType.OCC_EMPTY
,
and cannot be null
for any other
occurance indicatoroccurrence
- The occurence of the item type, must be one of
XQSequenceType.OCC_ZERO_OR_ONE
,
XQSequenceType.OCC_EXACTLY_ONE
,
XQSequenceType.OCC_ZERO_OR_MORE
,
XQSequenceType.OCC_ONE_OR_MORE
,
XQSequenceType.OCC_EMPTY
XQSequenceType
representing the
type of a sequence
javax.xml.xquery.XQException
- if (1) the item
is null
and the occurance is not XQSequenceType.OCC_EMPTY
,
(2) the item
is not null
and the occurance is XQSequenceType.OCC_EMPTY
,
(3) the occurence is not one of:
XQSequenceType.OCC_ZERO_OR_ONE
,
XQSequenceType.OCC_EXACTLY_ONE
,
XQSequenceType.OCC_ZERO_OR_MORE
,
XQSequenceType.OCC_ONE_OR_MORE
,
XQSequenceType.OCC_EMPTY
or (4) the underlying object implementing the
interface is closedpublic javax.xml.xquery.XQItemType createTextType() throws javax.xml.xquery.XQException
javax.xml.xquery.XQDataFactory
XQItemType
object representing the XQuery
text()
type. The XQItemType
object will have the
item kind set to XQItemType.XQITEMKIND_TEXT
.
createTextType
in interface javax.xml.xquery.XQDataFactory
XQItemType
representing the XQuery
text()
type
javax.xml.xquery.XQException
- if the underlying object implementing the interface is
closed
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |