You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlrpc-dev@ws.apache.org by Rob Walker <ro...@ascert.com> on 2003/02/10 13:05:00 UTC

(Fwd) Probs with & in data - working fix

In fact, having tested this, I found that I need a call to chardata() to make 
this work:

            else if (obj instanceof Hashtable)
            {
                startElement("struct");
                Hashtable struct = (Hashtable) obj;
                for (Enumeration e = struct.keys(); e.hasMoreElements(); )
                {
                    String nextkey = (String) e.nextElement();
                    Object nextval = struct.get(nextkey);
                    startElement("member");
                    startElement("name");
                    //write(nextkey);
                    chardata(nextkey.toString());


Works here anyhow - not sure if it's of use for the community.

-- Rob


------- Forwarded message follows -------
From:           	Rob Walker <ro...@ascert.com>
To:             	rpc-dev@xml.apache.org
Subject:        	Probs with & in data
Date sent:      	Mon, 10 Feb 2003 11:37:59 -0000

Ok,

I think I've found this one. I'm using a Hashtable, and the keys in my 
Hashtable can have an "&" in them.

Looking at the following code in XmlRpc.java.writeObject():

            else if (obj instanceof Hashtable)
            {
                startElement("struct");
                Hashtable struct = (Hashtable) obj;
                for (Enumeration e = struct.keys(); e.hasMoreElements(); )
                {
                    String nextkey = (String) e.nextElement();
                    Object nextval = struct.get(nextkey);
                    startElement("member");
                    startElement("name");
                    write(nextkey);


I suspect that the write(nextkey) should in fact be writeObject(nextkey).

-- Rob
------- End of forwarded message -------

Ascert - Taking systems to the Edge
robw@ascert.com
+44 (0)20 7488 3470
www.Ascert.com