axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From noah.fie...@jeppesen.com
Subject XMLUtils does not encode FF / 0xC character in Java Strings...
Date Fri, 22 Oct 2004 18:26:57 GMT
Hi,
        I am developing an AXIS/SOAP interface to a legacy system. A 
java-bean sent via soap includes a java.lang.String that often contains 
FormFeeds/FF/0xC. This is causing a parse error on the client side, with 
"invalid xml character... 0xc". 

        The class org.apache.axis. XMLUtils' method xmlEncodeString is the 
method used by the standard/default BeanSerializer to encode Java Strings. 
I would think it a good goal of AXIS to support Java Strings without 
limiting the characters that could be in those strings... I'm not sure the 
full set of special characters that need to be checked for (possibly this 
is why the FF character missed the implementation this far) but am pretty 
sure that other developers working w/legacy systems will run into this 
problem as well.

        The main classes that (IMHO) need modification are:
        org.apache.axis.utils.XMLUtils
                <method:  public static String xmlEncodeString(String orig 
>
        and possibly (I'm not sure what exactly this class does)
        org.apache.axis.utils.XMLChar
                <static int  int charRange[], possibly other methods>

        I've already implemented a workaround as I'm on a tight production 
schedule, so am not asking anyone for 'help', but think fixing this bug 
will help the AXIS community. The workaround 

        Thanks,
        Noah


The additional bit of code:
case '\f' : sBuf.append("&#xc;");
                    break;

Note: I think there is another bug in XMLUtils.java, that even though the 
'\r' character is recognized for encoding, it is not checked for in the 
above section that determines the bool 'needsEncoding':

switch(chars[i]) {
            case '&': case '"': case '\'': case '<': case '>': //***** 
where is the check for \r, or any others needed (i.e. if '\f' gets added)?
                needsEncoding = true;
Mime
View raw message