return s;
}
public Sequence eval(Sequence<? extends Item> contextSeq, ValueSequence argv, DynamicContext dynEnv) throws XQueryException {
assert (argv != null && argv.size() == 1);
Item firstItem = argv.getItem(0);
if(firstItem.isEmpty()) {
// Returns the zero-length string if $arg is the empty sequence.
return ValueSequence.EMPTY_SEQUENCE;
}
// If any of the code points in $arg is not a legal XML character,
// an error is raised [err:FOCH0001].
Iterator<? extends Item> argItor = firstItem.iterator();
assert (argItor.hasNext());
final StringBuilder buf = new StringBuilder(64);
while(argItor.hasNext()) {
Item it = argItor.next();
assert (it instanceof XInteger);
final int cp = (int) ((XInteger) it).getValue();
if(!XMLUtils.isValid(cp)) {
throw new DynamicError("err:FOCH0001", "Invalid XML char was detected: `" + cp
+ "`!");