for (int j=0; j<count; j++) { escaped.append("\\u"); String hex = Integer.toHexString(buffer.charAt(offset + j)); while (hex.length() < 4) { hex = "0" + hex;
for (int j=0; j<count; j++) { escaped.append("\\u"); String hex = Integer.toHexString(buffer.charAt(offset + j)); while (hex.length() < 4) { hex = "0" + hex;
char ch = buffer.charAt(i); if (UTF16CharacterSet.isHighSurrogate(ch)) { if (i + 1 >= buffer.length() || !UTF16CharacterSet.isLowSurrogate(buffer.charAt(i + 1))) { substitute(buffer, i, 1, context); if (i == 0 || !UTF16CharacterSet.isHighSurrogate(buffer.charAt(i - 1))) { substitute(buffer, i, 1, context); } else { int pair = UTF16CharacterSet.combinePair(buffer.charAt(i - 1), ch); if (!charChecker.test(pair)) { substitute(buffer, i - 1, 2, context);
char ch = buffer.charAt(i); if (UTF16CharacterSet.isHighSurrogate(ch)) { if (i + 1 >= buffer.length() || !UTF16CharacterSet.isLowSurrogate(buffer.charAt(i + 1))) { substitute(buffer, i, 1, context); if (i == 0 || !UTF16CharacterSet.isHighSurrogate(buffer.charAt(i - 1))) { substitute(buffer, i, 1, context); } else { int pair = UTF16CharacterSet.combinePair(buffer.charAt(i - 1), ch); if (!charChecker.test(pair)) { substitute(buffer, i - 1, 2, context);
if (nlen > 0 && sb.charAt(nlen - 1) == ' ') { sb.setLength(nlen - 1);
if (nlen > 0 && sb.charAt(nlen - 1) == ' ') { sb.setLength(nlen - 1);
ch = buffer.charAt(j++); if (UTF16CharacterSet.isHighSurrogate(ch)) { char low = buffer.charAt(j++); ch = UTF16CharacterSet.combinePair((char) ch, low); while (k > 0) { int step = 1; ch2 = target.charAt(k - 1); if (UTF16CharacterSet.isSurrogate(ch2)) { step = 2; char high = target.charAt(k - 2); ch2 = UTF16CharacterSet.combinePair(high, (char) ch2);
ch = buffer.charAt(j++); if (UTF16CharacterSet.isHighSurrogate(ch)) { char low = buffer.charAt(j++); ch = UTF16CharacterSet.combinePair((char) ch, low); while (k > 0) { int step = 1; ch2 = target.charAt(k - 1); if (UTF16CharacterSet.isSurrogate(ch2)) { step = 2; char high = target.charAt(k - 2); ch2 = UTF16CharacterSet.combinePair(high, (char) ch2);
int k = 0; while (k < end) { int next = buffer.charAt(k); int skip = 1; if (UTF16CharacterSet.isHighSurrogate((char) next)) { next = UTF16CharacterSet.combinePair((char) next, buffer.charAt(k + 1)); skip = 2; break; next = buffer.charAt(k); skip = 1; if (UTF16CharacterSet.isHighSurrogate((char) next)) { next = UTF16CharacterSet.combinePair((char) next, buffer.charAt(k + 1)); skip = 2;
int starterCh = target.charAt(0); int compPos = 1; if (UTF16CharacterSet.isHighSurrogate(starterCh)) { starterCh = UTF16CharacterSet.combinePair((char) starterCh, target.charAt(1)); compPos++; ch = target.charAt(decompPos++); if (UTF16CharacterSet.isHighSurrogate(ch)) { ch = UTF16CharacterSet.combinePair((char) ch, target.charAt(decompPos++));
public ValidationFailure validate( CharSequence input) { // if it's valid as an NCName then it's OK CharSequence trimmed = Whitespace.trimWhitespace(input); if (NameChecker.isValidNCName(trimmed)) { return null; } // if not, replace any colons by underscores and then test if it's a valid NCName FastStringBuffer buff = new FastStringBuffer(trimmed.length()); buff.append(trimmed); for (int i = 0; i < buff.length(); i++) { if (buff.charAt(i) == ':') { buff.setCharAt(i, '_'); } } if (NameChecker.isValidNCName(buff)) { return null; } else { return new ValidationFailure("The value '" + trimmed + "' is not a valid xs:Name"); } } }
int starterCh = target.charAt(0); int compPos = 1; if (UTF16CharacterSet.isHighSurrogate(starterCh)) { starterCh = UTF16CharacterSet.combinePair((char) starterCh, target.charAt(1)); compPos++; ch = target.charAt(decompPos++); if (UTF16CharacterSet.isHighSurrogate(ch)) { ch = UTF16CharacterSet.combinePair((char) ch, target.charAt(decompPos++));
int zz = maxFractionPartSize - minFractionPartSize; while (zz > 0) { if (fsb.charAt(fsb.length() - 1) == '0') { fsb.setLength(fsb.length() - 1); zz--; if (fsb.charAt(fsb.length() - 1) == '.') { fsb.setLength(fsb.length() - 1); if (minWholePartSize == 0 && intDigits == 1 && fsb.charAt(0) == '0') { fsb.removeCharAt(0); } else {
public ValidationFailure validate( CharSequence input) { // if it's valid as an NCName then it's OK CharSequence trimmed = Whitespace.trimWhitespace(input); if (NameChecker.isValidNCName(trimmed)) { return null; } // if not, replace any colons by underscores and then test if it's a valid NCName FastStringBuffer buff = new FastStringBuffer(trimmed.length()); buff.append(trimmed); for (int i = 0; i < buff.length(); i++) { if (buff.charAt(i) == ':') { buff.setCharAt(i, '_'); } } if (NameChecker.isValidNCName(buff)) { return null; } else { return new ValidationFailure("The value '" + trimmed + "' is not a valid xs:Name"); } } }
/** * Set the 32-bit character at a particular 16-bit offset in a string buffer, * replacing the previous character at that position, and taking account of the * fact that either, both, or neither of the characters might be a surrogate pair. * * @param target the StringBuffer in which the data is to be inserted * @param offset the position at which the data is to be inserted * @param ch32 the character to be inserted, as a 32-bit Unicode codepoint */ private static void setCharAt(FastStringBuffer target, int offset, int ch32) { if (ch32 < 65536) { if (UTF16CharacterSet.isHighSurrogate(target.charAt(offset))) { target.setCharAt(offset, (char) ch32); target.removeCharAt(offset + 1); } else { target.setCharAt(offset, (char) ch32); } } else { if (UTF16CharacterSet.isHighSurrogate(target.charAt(offset))) { target.setCharAt(offset, UTF16CharacterSet.highSurrogate(ch32)); target.setCharAt(offset + 1, UTF16CharacterSet.lowSurrogate(ch32)); } else { target.setCharAt(offset, UTF16CharacterSet.highSurrogate(ch32)); target.insert(offset + 1, UTF16CharacterSet.lowSurrogate(ch32)); } } }
/** * Set the 32-bit character at a particular 16-bit offset in a string buffer, * replacing the previous character at that position, and taking account of the * fact that either, both, or neither of the characters might be a surrogate pair. * * @param target the StringBuffer in which the data is to be inserted * @param offset the position at which the data is to be inserted * @param ch32 the character to be inserted, as a 32-bit Unicode codepoint */ private static void setCharAt(FastStringBuffer target, int offset, int ch32) { if (ch32 < 65536) { if (UTF16CharacterSet.isHighSurrogate(target.charAt(offset))) { target.setCharAt(offset, (char) ch32); target.removeCharAt(offset + 1); } else { target.setCharAt(offset, (char) ch32); } } else { if (UTF16CharacterSet.isHighSurrogate(target.charAt(offset))) { target.setCharAt(offset, UTF16CharacterSet.highSurrogate(ch32)); target.setCharAt(offset + 1, UTF16CharacterSet.lowSurrogate(ch32)); } else { target.setCharAt(offset, UTF16CharacterSet.highSurrogate(ch32)); target.insert(offset + 1, UTF16CharacterSet.lowSurrogate(ch32)); } } }
if ((valueType == ELEMENT || valueType == ATTRIBUTE) && !sb.isEmpty() && sb.charAt(0) == '{') { try { StructuredQName qn = StructuredQName.fromClarkName(sb.toString());
if ((valueType == ELEMENT || valueType == ATTRIBUTE) && !sb.isEmpty() && sb.charAt(0) == '{') { try { StructuredQName qn = StructuredQName.fromClarkName(sb.toString());
while (firstSpace < pi.length() && " \t\r\n".indexOf(pi.charAt(firstSpace)) >= 0) { firstSpace++;
while (firstSpace < pi.length() && " \t\r\n".indexOf(pi.charAt(firstSpace)) >= 0) { firstSpace++;