You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by tm...@apache.org on 2002/03/12 19:49:24 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/runtime StringValueHandler.java

tmiller     02/03/12 10:49:24

  Modified:    java/src/org/apache/xalan/xsltc/runtime
                        StringValueHandler.java
  Log:
  bug 5141, fix by Santiago Pericas-Geersen
  
  Revision  Changes    Path
  1.3       +26 -1     xml-xalan/java/src/org/apache/xalan/xsltc/runtime/StringValueHandler.java
  
  Index: StringValueHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/StringValueHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StringValueHandler.java	18 Jul 2001 15:36:01 -0000	1.2
  +++ StringValueHandler.java	12 Mar 2002 18:49:24 -0000	1.3
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: StringValueHandler.java,v 1.2 2001/07/18 15:36:01 morten Exp $
  + * @(#)$Id: StringValueHandler.java,v 1.3 2002/03/12 18:49:24 tmiller Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -85,5 +85,30 @@
   	final int length = _free;
   	_free = 0;		// getValue resets
   	return new String(_buffer, 0, length);
  +    }
  +
  +    /**
  +     * The value of a PI must not contain the substring "?>". Should
  +     * that substring be present, replace it by "? >". 
  +     */
  +    public String getValueOfPI() {
  +	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;
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org