public class ItemTypeFactory extends Object
The ItemTypeFactory
class is thread-safe.
Constructor and Description |
---|
ItemTypeFactory(Processor processor)
Create an ItemTypeFactory
|
Modifier and Type | Method and Description |
---|---|
ItemType |
getAtomicType(QName name)
Get an item type representing an atomic type.
|
ItemType |
getAttributeTest(QName name,
QName schemaType)
Get an ItemType that tests an element name and/or schema type.
|
ItemType |
getDocumentTest(ItemType elementTest)
Make an ItemType representing a document-node() test with an embedded element test.
|
ItemType |
getElementTest(QName name,
QName schemaType,
boolean nillable)
Make an ItemType that tests an element name and/or schema type.
|
XdmItem |
getExternalObject(Object object)
Factory method to construct an "external object".
|
ItemType |
getExternalObjectType(Class externalClass)
Get an ItemType representing the type of a Java object when used as an external object
for use in conjunction with calls on extension/external functions.
|
ItemType |
getItemType(XdmItem item)
Get an ItemType representing the type of a supplied XdmItem.
|
ItemType |
getItemType(XdmNodeKind kind,
QName name)
Get an item type that matches nodes of a specified kind with a specified name.
|
ItemType |
getNodeKindTest(XdmNodeKind kind)
Get an item type that matches any node of a specified kind.
|
ItemType |
getSchemaAttributeTest(QName name)
Get an ItemType representing an attribute declaration in the schema.
|
ItemType |
getSchemaElementTest(QName name)
Make an ItemType representing an element declaration in the schema.
|
public ItemTypeFactory(Processor processor)
processor
- the processor used by this ItemTypeFactory. This must be supplied
in the case of user-defined types or types that reference element or attribute names;
for built-in types it can be omitted.public ItemType getAtomicType(QName name) throws SaxonApiException
Processor
.
It is undefined whether two calls supplying the same QName will return the same ItemType object.
name
- the name of the built-in or user-defined atomic type requiredSaxonApiException
- if the type name is not known, or if the type identified by the
name is not an atomic type.public ItemType getNodeKindTest(XdmNodeKind kind)
This corresponds to the XPath syntactic forms element(), attribute(), document-node(), text(), comment(), processing-instruction(). It also provides an option, not available in the XPath syntax, that matches namespace nodes.
It is undefined whether two calls supplying the same argument value will return the same ItemType object.
kind
- the kind of node for which a NodeTest is requiredpublic ItemType getItemType(XdmNodeKind kind, QName name)
This corresponds to the XPath syntactic forms element(name), attribute(name), and processing-instruction(name). In the case of processing-instruction, the supplied QName must have no namespace.
It is undefined whether two calls supplying the same argument values will return the same ItemType object.
kind
- the kind of nodes that matchname
- the name of the nodes that matchIllegalArgumentException
- if the node kind is other than element, attribute, or
processing instruction, or if the node kind is processing instruction and the name is in a namespace.public ItemType getSchemaElementTest(QName name) throws SaxonApiException
schema-element(element-name)
It is undefined whether two calls supplying the same argument values will return the same ItemType object.
name
- the element nameSaxonApiException
- if the schema does not contain a global element declaration
for the given namepublic ItemType getElementTest(QName name, QName schemaType, boolean nillable) throws SaxonApiException
element(element-name, type)
It is undefined whether two calls supplying the same argument values will return the same ItemType object.
name
- the element name, or null if there is no constraint on the name (equivalent to
specifying element(*, type)
)schemaType
- the name of the required schema type, or null if there is no constraint
on the type (equivalent to specifying element(name)
)nillable
- if a nilled element is allowed to match the type (equivalent to specifying
"?" after the type name). The value is ignored if schemaType is null.SaxonApiException
- if the schema does not contain a global element declaration
for the given namepublic ItemType getSchemaAttributeTest(QName name) throws SaxonApiException
schema-attribute(attribute-name)
It is undefined whether two calls supplying the same argument values will return the same ItemType object.
name
- the attribute nameSaxonApiException
- if the schema does not contain a global attribute declaration
for the given namepublic ItemType getAttributeTest(QName name, QName schemaType) throws SaxonApiException
element(element-name, type)
It is undefined whether two calls supplying the same argument values will return the same ItemType object.
name
- the element name, or null if there is no constraint on the name (equivalent to
specifying element(*, type)
)schemaType
- the name of the required schema type, or null of there is no constraint
on the type (equivalent to specifying element(name)
)SaxonApiException
- if the schema does not contain a global element declaration
for the given namepublic ItemType getDocumentTest(ItemType elementTest)
document-node(element(N, T))
or
document-node(schema-element(N))
.
It is undefined whether two calls supplying the same argument values will return the same ItemType object.
elementTest
- the elementTest. An IllegalArgumentException is thrown if the supplied
ItemTest is not an elementTest or schemaElementTest.public ItemType getExternalObjectType(Class externalClass)
externalClass
- a Java classpublic XdmItem getExternalObject(Object object)
Changed in Saxon 9.5 to return XdmItem rather than XdmAtomicValue, since wrapped external objects are now modelled as a separate type of item, rather than as an atomic value.
object
- the value to be wrapped as an external object. Must not be null.public ItemType getItemType(XdmItem item)
item
- the supplied item whose type is requiredCopyright (c) 2004-2013 Saxonica Limited. All rights reserved.