FileDocCategorySizeDatePackage
StringValueHandler.javaAPI DocJava SE 5 API3112Fri Aug 26 14:55:40 BST 2005com.sun.org.apache.xalan.internal.xsltc.runtime

StringValueHandler

public final class StringValueHandler extends EmptySerializer
author
Jacek Ambroziak
author
Santiago Pericas-Geertsen
author
Morten Jorgensen

Fields Summary
private StringBuffer
_buffer
private String
_str
private static final String
EMPTY_STR
private boolean
m_escaping
private int
_nestedLevel
Constructors Summary
Methods Summary
public voidcharacters(char[] ch, int off, int len)

	
            
	  
    
	if (_nestedLevel > 0)
	    return;
	
	if (_str != null) {
	    _buffer.append(_str);
	    _str = null;
	}
	_buffer.append(ch, off, len);
    
public voidcharacters(java.lang.String characters)

	if (_nestedLevel > 0)
	    return;

	if (_str == null && _buffer.length() == 0) {
	    _str = characters;
	}
	else {
	    if (_str != null) {
	        _buffer.append(_str);
	        _str = null;
	    }
	    
	    _buffer.append(characters);
	}
    
public voidendElement(java.lang.String qname)

        _nestedLevel--;
    
public java.lang.StringgetValue()

	if (_buffer.length() != 0) {
	    String result = _buffer.toString();
	    _buffer.setLength(0);
	    return result;
	}
	else {
	    String result = _str;
	    _str = null;
	    return (result != null) ? result : EMPTY_STR;
	}
    
public java.lang.StringgetValueOfPI()
The value of a PI must not contain the substring "?>". Should that substring be present, replace it by "? >".

	final String value = getValue();

	if (value.indexOf("?>") > 0) {
	    final int n = value.length(); 
	    final StringBuffer valueOfPI = new StringBuffer();

	    for (int i = 0; i < n;) {
		final char ch = value.charAt(i++);
		if (ch == '?" && value.charAt(i) == '>") {
		    valueOfPI.append("? >"); i++;
		}
		else {
		    valueOfPI.append(ch);
		}
	    } 
	    return valueOfPI.toString();
	}
	return value;
    
public booleansetEscaping(boolean bool)

        boolean oldEscaping = m_escaping;
        m_escaping = bool;

        return bool;
    
public voidstartElement(java.lang.String qname)

        _nestedLevel++;