You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by James M Snell <ja...@us.ibm.com> on 2001/12/01 01:33:48 UTC
Axis Serialization Problem
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 & 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