Extensibility mechanisms
For external Java objects, the mapping from Java class names to XPath type names in namespace
http://saxon.sf.net/java-type
has been refined. The convention that a "$"
character in the Java class name is replaced by a hyphen ("-") in the XPath name is now
applied systematically (previously, it was only applied on some code paths). A new convention
is introduced allowing array types to be represented: any "[" at the start of the Java class
name is replaced by "_-" (underscore then hyphen). So for example the QName representing the
Java class byte[]
(binary name [B
) is now
Q{http://saxon.sf.net/java-type}_-B
, while byte[][]
(binary name
[[B
) becomes Q{http://saxon.sf.net/java-type}_-_-B
.
For reflexive extension functions, a new scheme involving generics is available to allow more
precise type checking, corresponding more closely to the way that native (XSLT or XQuery)
function calls work. The arguments of a method can now be declared for example as
ZeroOrMore<IntegerValue>
, OneOrMore<NodeInfo>
,
ZeroOrOne<StringValue>
, or One<BooleanValue>
to indicate
both the expected item type and the cardinality. When arguments or result are described using
this notation, the function conversion rules operate exactly as for native function calls.