axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James M Snell" <jasn...@us.ibm.com>
Subject Axis Serialization Problem
Date Sat, 01 Dec 2001 00:33:48 GMT
Sam, 

The serialization problem I was running into has to do with the fact that 
the SAX Parser automatically replaces entities with their expanded forms. 
So &amp; always becomes &.  The sax recorder records the "&".  When the 
SAXOutputer calls the SerializationContext's writeChars(...) method, it is 
passing it only the &.  So the change needs to be made in the writeChars 
method.

The current writeChars method shown below:

    public void writeChars(char [] p1, int p2, int p3)
        throws IOException
    {
        if (writingStartTag) {
            writer.write(">");
            writingStartTag = false;
        }
        writer.write(p1, p2, p3); 
        writer.flush();
        onlyXML=false;
    }

Needs to change:

   public void writeChars(char[] p1, int p2, int p3)
        throws IOException 
   {
       writeSafeString(String.valueOf(p1,p2,p3));
    }

This will ensure that all ampersands and other standard entities are 
properly escaped in the reserialized results.  I see no other way around 
it.  Unless you can think of a better workaround, I will commit this 
change.  Please let me know ASAP as I need this to get fixed right away.

- James M Snell/Fresno/IBM
    Web services architecture and strategy
    Internet Emerging Technologies, IBM
    544.9035 TIE line
    559.587.1233 Office
    919.486.0077 Voice Mail
    jasnell@us.ibm.com
=================================================================
Have I not commanded you?  Be strong and courageous.  Do not be terrified, 

do not be discouraged, for the Lord your God will be with you wherever you 
go.  
- Joshua 1:9

Mime
View raw message