axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From noah.fie...@jeppesen.com
Subject RE: XMLUtils does not encode FF / 0xC character in Java Strings...
Date Fri, 22 Oct 2004 20:45:58 GMT
Hi,
        Thank you (and the previous poster) for the quick responses. I 
searched quite a bit thru the archives & couldn't find the discussion... 
if you have a link, that would be great.

        As for the issue of FF in XML, after much reading I do understand 
that it is not allowed, even when encoded, in XML. 

        AXIS should not generate invalid XML, but rather throw an 
exception in this case. If, for either performance or other-reasons the 
functionality is left as-is, there should be a *huge* warning in the 
documentation about using the BeanSerializer / WSDL2Java for anything 
other than 'hello world' apps. WSDL<->Java (and other languages) is talked 
about as a 'holy grail' technology to ease RPC style services, and the 
current documentation leads developers down the garden path of believing 
anything compliant with the javaBean spec will work. This is not currently 
the case.

        Thanks for your emails - I admit, my original take on the issue 
lacked knowledge of XML characters etc...
        Noah





"Kellogg, Richard" <RKellogg@MICROS.COM> 
10/22/2004 11:39 AM
Please respond to
axis-dev@ws.apache.org


To
<axis-dev@ws.apache.org>
cc

Subject
RE: XMLUtils does not encode FF / 0xC character in Java Strings...







Noah,
 
Please  search the mail archive.  This issue has been discussed at length.
 
Rick  Kellogg
 
-----Original Message-----
From: noah.fiedel@jeppesen.com  [mailto:noah.fiedel@jeppesen.com]
Sent: Friday, October 22, 2004  2:27 PM
To: axis-dev@ws.apache.org
Subject: XMLUtils does  not encode FF / 0xC character in Java Strings... 



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