final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
final DataOutput dOut = abvs.getDataOutput();
final ArrayBackedValueStorage abvsParamQName = new ArrayBackedValueStorage();
final DataOutput dOutParamQName = abvsParamQName.getDataOutput();
final SequencePointable seqp = (SequencePointable) SequencePointable.FACTORY.createPointable();
final TaggedValuePointable tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
return new AbstractTaggedValueArgumentScalarEvaluator(args) {
@Override
protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
TaggedValuePointable tvp1 = args[0];
TaggedValuePointable tvp2 = args[1];
// Only accept a strings.
if (args.length == 2) {
if (tvp1.getTag() == ValueTag.SEQUENCE_TAG) {
tvp1.getValue(seqp);
if (seqp.getEntryCount() == 0) {
XDMConstants.setEmptyString(tvp);
tvp.getValue(paramURI);
} else {
throw new SystemException(ErrorCode.FORG0006);
}
} else {
if (!FunctionHelper.isDerivedFromString(tvp1.getTag())) {
throw new SystemException(ErrorCode.FORG0006);
}
tvp1.getValue(paramURI);
}
if (tvp2.getTag() != ValueTag.XS_STRING_TAG) {
throw new SystemException(ErrorCode.FORG0006);
}
tvp2.getValue(paramQName);
} else if (args.length == 1) {
if (tvp1.getTag() != ValueTag.XS_STRING_TAG) {
throw new SystemException(ErrorCode.FORG0006);
}
XDMConstants.setEmptyString(tvp);
tvp.getValue(paramURI);
tvp2.getValue(paramQName);
} else {
throw new SystemException(ErrorCode.FORG0006);
}
try {