public class Extensions extends Object
To invoke these functions, use a function call of the form
prefix:name()
where
name is the method name, and prefix maps to the URI http://saxon.sf.net/
Modifier and Type | Method and Description |
---|---|
static ZeroOrOne<DateTimeValue> |
adjustToCivilTime(XPathContext context,
ZeroOrOne<DateTimeValue> date,
One<StringValue> region)
Adjust a given date/time to a specified civil time zone, taking account of summer time
(daylight savings time) changes, as obtained from the Java database of changes to daylight
savings time.
|
static byte[] |
base64BinaryToOctets(One<Base64BinaryValue> in)
Convert a base64Binary value to a sequence of integers representing the octets contained in the value
|
static ZeroOrOne<StringValue> |
base64BinaryToString(XPathContext context,
ZeroOrOne<Base64BinaryValue> in,
One<StringValue> encoding)
Convert a base64Binary value to a String, assuming a particular encoding
|
static One<IntegerValue> |
columnNumber(XPathContext c)
Return the column number of the context node.
|
static One<IntegerValue> |
columnNumber(ZeroOrOne<NodeInfo> node)
Return the column number of the specified node.
|
static ZeroOrOne<QNameValue> |
currentModeName(XPathContext context)
Get the current mode.
|
static ZeroOrOne<DecimalValue> |
decimalDivide(ZeroOrOne<DecimalValue> arg1,
ZeroOrOne<DecimalValue> arg2,
One<IntegerValue> scale)
Perform decimal division to a user-specified precision
|
static ZeroOrOne<NodeInfo> |
discardDocument(XPathContext context,
ZeroOrOne<NodeInfo> document)
Remove a document from the document pool.
|
static ZeroOrMore<Item> |
eager(ZeroOrMore<Item> value)
Force eager evaluation of the expression supplied as the argument.
|
static Configuration |
getConfiguration(XPathContext c)
Return the Configuration object
|
static XPathContext |
getContext(XPathContext c)
Return the XPathContext object
|
static Controller |
getController(XPathContext c)
Return the Controller object
|
static One<StringValue> |
getPseudoAttribute(XPathContext c,
One<StringValue> name)
Get a pseudo-attribute of a processing instruction.
|
static One<BooleanValue> |
hasSameNodes(ZeroOrMore<NodeInfo> p1,
ZeroOrMore<NodeInfo> p2)
Determine whether two node sequence contain the same sequences of nodes, in the same order, compared by identity
|
static byte[] |
hexBinaryToOctets(One<HexBinaryValue> in)
Convert a hexBinary value to a sequence of integers representing the octets contained in the value
|
static ZeroOrOne<StringValue> |
hexBinaryToString(XPathContext context,
ZeroOrOne<HexBinaryValue> in,
One<StringValue> encoding)
Convert a hexBinary value to a String, assuming a particular encoding
|
static ZeroOrOne<BooleanValue> |
inSummerTime(XPathContext context,
One<DateTimeValue> date,
One<StringValue> region)
Determine whether a given date/time is in summer time (daylight savings time)
in a given region.
|
static ZeroOrOne<BooleanValue> |
isDefaulted(ZeroOrOne<NodeInfo> arg)
Ask whether an attribute node exists as a result of the expansion of
default and fixed values defined in a schema.
|
static One<IntegerValue> |
lineNumber(XPathContext c)
Return the line number of the context node.
|
static One<IntegerValue> |
lineNumber(ZeroOrOne<NodeInfo> node)
Return the line number of the specified node.
|
static One<NodeInfo> |
namespaceNode(XPathContext context,
One<StringValue> prefix,
One<StringValue> uri)
Create a parentless namespace node.
|
static ZeroOrOne<Base64BinaryValue> |
octetsToBase64Binary(byte[] in)
Convert a sequence of integers in the range 0-255, representing a sequence of octets,
to a base64Binary value
|
static ZeroOrOne<HexBinaryValue> |
octetsToHexBinary(byte[] in)
Convert a sequence of integers in the range 0-255, representing a sequence of octets,
to a hexBinary value
|
static One<StringValue> |
path(XPathContext c)
Return an XPath expression that identifies the current node
|
static One<StringValue> |
path(XPathContext context,
One<NodeInfo> node)
Return an XPath expression that identifies a specified node
|
static void |
pauseTracing(XPathContext c)
Switch tracing off.
|
static One<StringValue> |
printStack(XPathContext c)
Return a string containing a diagnostic print of the current execution stack
|
static One<Base64BinaryValue> |
readBinaryResource(One<StringValue> uri)
Read the contents of a binary resource identified by a URI
|
static void |
resumeTracing(XPathContext c)
Resume tracing.
|
static ZeroOrOne<Base64BinaryValue> |
stringToBase64Binary(ZeroOrOne<StringValue> in,
One<StringValue> encoding)
Convert a string to a base64Binary value in a given encoding
|
static ZeroOrOne<HexBinaryValue> |
stringToHexBinary(ZeroOrOne<StringValue> in,
One<StringValue> encoding)
Convert a string to a hexBinary value in a given encoding
|
static ZeroOrMore<IntegerValue> |
stringToUtf8(One<StringValue> in)
Get the UTF-8 encoding of a string
|
static One<StringValue> |
systemId(XPathContext c)
Return the system identifier of the context node
|
static ZeroOrOne<Function> |
type(ZeroOrOne<Item> value)
Determine the type annotation of a node or an atomic value in the form of a
function item representing the type definition as a schema component, allowing
navigation to other related schema components.
|
static ZeroOrOne<QNameValue> |
typeAnnotation(XPathContext context,
ZeroOrOne<Item> value)
Determine the value of the type annotation of a node or an atomic value
|
static ZeroOrMore<StringValue> |
unparsedEntities(One<NodeInfo> doc)
Get a list of the names of the unparsed entities in a document
|
static boolean |
validCharacter(XPathContext c,
int in)
Test whether a given integer is the codepoint of a valid XML character
|
public static void pauseTracing(XPathContext c)
c
- the XPath dynamic contextpublic static void resumeTracing(XPathContext c)
c
- the XPath dynamic contextpublic static One<StringValue> systemId(XPathContext c) throws XPathException
c
- the XPath dynamic contextXPathException
public static One<IntegerValue> lineNumber(XPathContext c)
c
- the XPath dynamic contextpublic static One<IntegerValue> lineNumber(ZeroOrOne<NodeInfo> node)
node
- the node whose line number is requiredpublic static One<IntegerValue> columnNumber(XPathContext c)
c
- the XPath dynamic contextpublic static One<IntegerValue> columnNumber(ZeroOrOne<NodeInfo> node)
node
- the node whose column number is requiredpublic static ZeroOrOne<NodeInfo> discardDocument(XPathContext context, ZeroOrOne<NodeInfo> document)
context
- the evaluation context (supplied implicitly by the call mechanism)document
- the document to be released from the document poolpublic static One<BooleanValue> hasSameNodes(ZeroOrMore<NodeInfo> p1, ZeroOrMore<NodeInfo> p2) throws XPathException
p1
- The first node-set. The iterator must be correctly ordered.p2
- The second node-set. The iterator must be correctly ordered.XPathException
public static One<StringValue> path(XPathContext context, One<NodeInfo> node) throws XPathException
node
- the node whose path is requiredXPathException
public static One<StringValue> path(XPathContext c) throws XPathException
c
- the XPath dynamic contextXPathException
public static ZeroOrOne<QNameValue> typeAnnotation(XPathContext context, ZeroOrOne<Item> value)
context
- the XPath dynamic contextvalue
- the node or atomic value whose type annotation is requiredpublic static ZeroOrOne<Function> type(ZeroOrOne<Item> value)
value
- the node or atomic value whose type annotation is requiredpublic static XPathContext getContext(XPathContext c)
c
- the context objectpublic static Controller getController(XPathContext c)
c
- the XPath dynamic contextpublic static Configuration getConfiguration(XPathContext c)
c
- the XPath dynamic contextpublic static One<StringValue> printStack(XPathContext c)
c
- the XPath dynamic contextpublic static ZeroOrMore<Item> eager(ZeroOrMore<Item> value)
value
- any valuepublic static One<StringValue> getPseudoAttribute(XPathContext c, One<StringValue> name) throws XPathException
c
- the XPath dynamic context. The context item should be a processing instruction,
though it doesn't matter if it isn't: the function will look at the string-value of the context item
whatever it is.name
- the name of the required pseudo-attributeXPathException
public static ZeroOrOne<DecimalValue> decimalDivide(ZeroOrOne<DecimalValue> arg1, ZeroOrOne<DecimalValue> arg2, One<IntegerValue> scale) throws XPathException
arg1
- the numeratorarg2
- the denominatorscale
- the required number of digits in the result of the divisionXPathException
- if scale exceeds the size of an intpublic static ZeroOrMore<IntegerValue> stringToUtf8(One<StringValue> in)
in
- the supplied stringpublic static ZeroOrOne<Base64BinaryValue> octetsToBase64Binary(byte[] in)
in
- the input array of bytes (octets)public static ZeroOrOne<HexBinaryValue> octetsToHexBinary(byte[] in)
in
- the input array of bytes (octets)public static byte[] base64BinaryToOctets(One<Base64BinaryValue> in)
in
- the supplied base64Binary valuepublic static byte[] hexBinaryToOctets(One<HexBinaryValue> in)
in
- the input hexBinary valuepublic static ZeroOrOne<StringValue> base64BinaryToString(XPathContext context, ZeroOrOne<Base64BinaryValue> in, One<StringValue> encoding) throws XPathException
context
- the XPath dynamic contextin
- the supplied base64Binary valueencoding
- the character encodingXPathException
- for example if the encoding is not recognized or if the binary value is not valid in this
encoding.public static ZeroOrOne<Base64BinaryValue> stringToBase64Binary(ZeroOrOne<StringValue> in, One<StringValue> encoding) throws IOException
in
- the input stringencoding
- the desired encodingIOException
public static ZeroOrOne<StringValue> hexBinaryToString(XPathContext context, ZeroOrOne<HexBinaryValue> in, One<StringValue> encoding) throws XPathException
context
- the XPath dynamic contextin
- the supplied hexBinary valueencoding
- the character encodingXPathException
- if the encoding is not recognized or if the binary value is not valid in this encoding.public static One<Base64BinaryValue> readBinaryResource(One<StringValue> uri) throws XPathException
uri
- the URI of the resource to be readXPathException
- if an I/O error occurs, for example if the resource cannot be readpublic static ZeroOrOne<HexBinaryValue> stringToHexBinary(ZeroOrOne<StringValue> in, One<StringValue> encoding) throws XPathException
in
- the input stringencoding
- the desired encodingXPathException
- in the event of a dynamic error, for example if the encoding is invalid or the
binary value is not valid in this encoding.public static boolean validCharacter(XPathContext c, int in)
c
- the XPath dynamic contextin
- the character to be testedpublic static One<NodeInfo> namespaceNode(XPathContext context, One<StringValue> prefix, One<StringValue> uri) throws XPathException
context
- the dynamic evaluation contextprefix
- the name of the namespace nodeuri
- the string value of the namespace nodeXPathException
- for example if the prefix is not a valid NCName, or if the URI is empty.public static ZeroOrMore<StringValue> unparsedEntities(One<NodeInfo> doc)
doc
- the document node of the document whose unparsed entities are requiredpublic static ZeroOrOne<BooleanValue> inSummerTime(XPathContext context, One<DateTimeValue> date, One<StringValue> region)
context
- used to get the implicit timezone in the event that the supplied date/time
has no timezonedate
- the date/time in question. This should preferably include a timezone offset.
If it does not, the implicit timezone from the dynamic context is used.region
- either the two-letter ISO country code, or an Olsen timezone name such as
"America/New_York" or "Europe/Lisbon". If the country code denotes a country spanning several
timezones, such as the US, then one of them is chosen arbitrarily.public static ZeroOrOne<DateTimeValue> adjustToCivilTime(XPathContext context, ZeroOrOne<DateTimeValue> date, One<StringValue> region)
context
- used to get the implicit timezone in the event that the supplied date/time
has no timezonedate
- the date/time in question. This should preferably include a timezone offset.
If it does not, the implicit timezone from the dynamic context is used.region
- An Olsen timezone name such as "America/New_York" or "Europe/Lisbon".adjust-to-civil-time(xs:dateTime('2008-01-10T12:00:00Z', 'America/New_York')
returns 2008-01-10T07:00:00-05:00
adjust-to-civil-time(xs:dateTime('2008-07-10T12:00:00Z', 'America/New_York')
returns 2008-07-10T08:00:00-04:00
public static ZeroOrOne<QNameValue> currentModeName(XPathContext context)
context
- the dynamic contextpublic static ZeroOrOne<BooleanValue> isDefaulted(ZeroOrOne<NodeInfo> arg)
FeatureKeys.EXPAND_ATTRIBUTE_DEFAULTS
and FeatureKeys.MARK_DEFAULTED_ATTRIBUTES
are set. The property is currently maintained only for attribute nodes in a TinyTree that results from schema
validation, or where DTD-defined defaults are notified by the XML parser.arg
- the attribute node in question, or nullCopyright (c) 2004-2014 Saxonica Limited. All rights reserved.