/** * Convert contents of the FastStringBuffer to a string */ public String toString() { condense(); // has side-effects which is nasty on the debugger! return new String(array, 0, used); }
/** * Convert contents of the FastStringBuffer to a string */ public String toString() { condense(); // has side-effects which is nasty on the debugger! return new String(array, 0, used); }
public static StringValue generateId(NodeInfo node) { FastStringBuffer buffer = new FastStringBuffer(FastStringBuffer.C16); node.generateId(buffer); buffer.condense(); return new StringValue(buffer); }
public static StringValue generateId(NodeInfo node) { FastStringBuffer buffer = new FastStringBuffer(FastStringBuffer.C16); node.generateId(buffer); buffer.condense(); return new StringValue(buffer); }
private CharSequence normalize(CharSequence in, boolean containsNullMarkers) { if (containsNullMarkers) { FastStringBuffer out = new FastStringBuffer(in.length()); String s = in.toString(); int start = 0; int nextNull = s.indexOf((char)0); while (nextNull >= 0) { out.append(normalizer.normalize(s.substring(start, nextNull))); out.append((char) 0); start = nextNull + 1; nextNull = s.indexOf((char) 0, start); out.append(s.substring(start, nextNull)); out.append((char) 0); start = nextNull + 1; nextNull = s.indexOf((char) 0, start); } out.append(normalizer.normalize(s.substring(start))); return out.condense(); } else { return normalizer.normalize(in); } }
private CharSequence normalize(CharSequence in, boolean containsNullMarkers) { if (containsNullMarkers) { FastStringBuffer out = new FastStringBuffer(in.length()); String s = in.toString(); int start = 0; int nextNull = s.indexOf((char)0); while (nextNull >= 0) { out.append(normalizer.normalize(s.substring(start, nextNull))); out.append((char) 0); start = nextNull + 1; nextNull = s.indexOf((char) 0, start); out.append(s.substring(start, nextNull)); out.append((char) 0); start = nextNull + 1; nextNull = s.indexOf((char) 0, start); } out.append(normalizer.normalize(s.substring(start))); return out.condense(); } else { return normalizer.normalize(in); } }
textNode = textNode.getNextSibling(); return fsb.condense();
textNode = textNode.getNextSibling(); return fsb.condense();
/** * Get the value of the item as a CharSequence. This is in some cases more efficient than * the version of the method that returns a String. */ public CharSequence getStringValueCS() { FastStringBuffer fsb = new FastStringBuffer(FastStringBuffer.C64); boolean first = true; for (AtomicValue av : content) { if (!first) { fsb.append(' '); } else { first = false; } fsb.append(av.getStringValueCS()); } return fsb.condense(); }
sb.append(punctuationTokens.get(punctuationTokens.size() - 1)); return sb.condense();
/** * Get the value of the item as a CharSequence. This is in some cases more efficient than * the version of the method that returns a String. */ public CharSequence getStringValueCS() { FastStringBuffer fsb = new FastStringBuffer(FastStringBuffer.C64); boolean first = true; for (AtomicValue av : content) { if (!first) { fsb.append(' '); } else { first = false; } fsb.append(av.getStringValueCS()); } return fsb.condense(); }
/** * Return the Unicode string corresponding to a given sequence of Unicode code values * * @param chars iterator delivering the characters as integer values * @param checker used to test whether a character is valid in the appropriate XML version * @return the sequence of characters as a CharSequence * @throws net.sf.saxon.trans.XPathException * if any of the integers is not the codepoint of a valid XML character */ public static CharSequence unicodeToString(SequenceIterator chars, IntPredicate checker) throws XPathException { FastStringBuffer sb = new FastStringBuffer(FastStringBuffer.C64); while (true) { NumericValue nextInt = (NumericValue) chars.next(); if (nextInt == null) { return sb.condense(); } long next = nextInt.longValue(); if (next < 0 || next > Integer.MAX_VALUE || !checker.test((int) next)) { throw new XPathException("codepoints-to-string(): invalid XML character [x" + Integer.toHexString((int) next) + ']', "FOCH0001"); } sb.appendWideChar((int) next); } }
public CharSequence getStringValueCS() { FastStringBuffer sb = null; NodeImpl next = getFirstChild(); while (next != null) { if (next instanceof TextImpl) { if (sb == null) { sb = new FastStringBuffer(FastStringBuffer.C64); } sb.append(next.getStringValueCS()); } next = next.getNextInDocument(this); } if (sb == null) { return ""; } return sb.condense(); }
public CharSequence getStringValueCS() { FastStringBuffer sb = null; NodeImpl next = getFirstChild(); while (next != null) { if (next instanceof TextImpl) { if (sb == null) { sb = new FastStringBuffer(FastStringBuffer.C64); } sb.append(next.getStringValueCS()); } next = next.getNextInDocument(this); } if (sb == null) { return ""; } return sb.condense(); }
/** * Return the Unicode string corresponding to a given sequence of Unicode code values * * @param chars iterator delivering the characters as integer values * @param checker used to test whether a character is valid in the appropriate XML version * @return the sequence of characters as a CharSequence * @throws net.sf.saxon.trans.XPathException * if any of the integers is not the codepoint of a valid XML character */ public static CharSequence unicodeToString(SequenceIterator chars, IntPredicate checker) throws XPathException { FastStringBuffer sb = new FastStringBuffer(FastStringBuffer.C64); while (true) { NumericValue nextInt = (NumericValue) chars.next(); if (nextInt == null) { return sb.condense(); } long next = nextInt.longValue(); if (next < 0 || next > Integer.MAX_VALUE || !checker.test((int) next)) { throw new XPathException("codepoints-to-string(): invalid XML character [x" + Integer.toHexString((int) next) + ']', "FOCH0001"); } sb.appendWideChar((int) next); } }
/** * Get the value of the item as a CharSequence. This is in some cases more efficient than * the version of the method that returns a String. */ public CharSequence getStringValueCS() { // Might not be the same as the string value of the underlying node because of space stripping switch (getNodeKind()) { case Type.DOCUMENT: case Type.ELEMENT: AxisIterator iter = iterateAxis(AxisInfo.DESCENDANT, NodeKindTest.makeNodeKindTest(Type.TEXT)); FastStringBuffer sb = new FastStringBuffer(FastStringBuffer.C64); while (true) { NodeInfo it = iter.next(); if (it == null) { break; } sb.append(it.getStringValueCS()); } return sb.condense(); default: return node.getStringValueCS(); } }
/** * Get the value of the item as a CharSequence. This is in some cases more efficient than * the version of the method that returns a String. */ public CharSequence getStringValueCS() { // Might not be the same as the string value of the underlying node because of space stripping switch (getNodeKind()) { case Type.DOCUMENT: case Type.ELEMENT: AxisIterator iter = iterateAxis(AxisInfo.DESCENDANT, NodeKindTest.makeNodeKindTest(Type.TEXT)); FastStringBuffer sb = new FastStringBuffer(FastStringBuffer.C64); while (true) { NodeInfo it = iter.next(); if (it == null) { break; } sb.append(it.getStringValueCS()); } return sb.condense(); default: return node.getStringValueCS(); } }
currentEvent = END_ELEMENT; if (combinedText != null) { return combinedText.condense(); } else { return "";
return buff.condense();