RE: Fixes to SoapParser
"Mike Jones" <[email protected]> Sat, 16 Aug 2003 22:46:23 -0600
| Newsgroups | gmane.comp.java.enhydra.ksoap |
|---|---|
| Message-ID | <[email protected]> |
Stephan,
Here is the diff to SoapParser:
44a45
> Hashtable arrayMap = new Hashtable ();
124c125
< Object obj;
---
> Object obj = null;
151,152c152
< if (attr == null) attr = start.getAttribute
< (classMap.xsi, "null");
---
> if (attr == null) attr = start.getAttribute(classMap.xsi,
"null");
171a172,174
>
> obj = classMap.readInstance
> (this, namespace, name, expected);
174c177,178
< if (start.getAttribute (classMap.enc, "arrayType")
!= null) {
---
> attr = start.getAttribute (classMap.enc,
"arrayType");
> if (attr != null) {
177c181,195
< }
---
> obj = classMap.readInstance
> (this, namespace, name, expected);
> String arrayType = attr.getValue();
>
> if (arrayType != null && arrayType.length() > 0)
{
> int cut = arrayType.indexOf(':');
> int end = arrayType.indexOf('[');
> String nm = arrayType.substring(cut + 1,
end);
> String prefix = cut == -1 ? "" :
arrayType.substring(0, cut);
> // This does not get the namespace.
> String ns =
start.getPrefixMap().getNamespace(prefix);
> SoapPrimitive primitive = new
SoapPrimitive(ns, nm, null);
> arrayMap.put(obj, primitive);
> }
> }
179,185c197,219
< Object [] names = classMap.getInfo
< (expected.type, null);
<
< namespace = (String) names [0];
< name = (String) names [1];
<
< // System.out.println ("getInfo for
"+expected.type+": {"+namespace+"}"+name);
---
> String id = start.getValueDefault ("id",
null);
> if (id != null) {
> Object hlp = idMap.get (id);
> if (hlp instanceof FwdRef) {
> FwdRef f = (FwdRef) hlp;
> if
(arrayMap.containsKey(f.obj)) {
> SoapPrimitive
primitive = (SoapPrimitive) arrayMap.get(f.obj);
> namespace =
primitive.getNamespace();
> name =
primitive.getName();
> obj =
classMap.readInstance
> (this,
primitive.getNamespace(), primitive.getName(), expected);
> }
> }
> }
> else {
> Object [] names =
classMap.getInfo(expected.type, null);
>
> namespace = (String) names [0];
> name = (String) names [1];
>
> obj = classMap.readInstance
> (this, namespace, name,
expected);
> }
188,190c222,225
<
< obj = classMap.readInstance
< (this, namespace, name, expected);
---
> else {
> obj = classMap.readInstance
> (this, namespace, name, expected);
> }
208,209c243,259
< ((Vector) f.obj)
< .setElementAt (obj, f.index);
---
> {
> if (arrayMap.containsKey(f.obj))
> {
> // The hash changes when adding
elements, so we need to rehash.
> // This is not efficient code
and a better strategy is needed!
> SoapPrimitive primitive =
(SoapPrimitive) arrayMap.get(f.obj);
> arrayMap.remove(f.obj);
> ((Vector) f.obj)
> .setElementAt (obj, f.index);
> arrayMap.put(f.obj, primitive);
> }
> else
> {
> ((Vector) f.obj)
> .setElementAt (obj, f.index);
> }
> }
Mike
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of Stefan Haustein
Sent: Thursday, August 07, 2003 1:59 PM
To: [email protected]
Subject: Re: Ksoap: Fixes to SoapParser
Mike Jones wrote:
> Until I find a diff tool, here is the whole parser class with changes.
> What this class does is takes a soap message with an array, coded
using
> the href tag as shown below. The implementation is not the best
> algorithm, but the first question is this:
Mike,
thanks for the file!
Arrays using the href tag *shold* have been working all the time.... Do
you remember what the actual problem was?
I would like to limit changes of ksoap1 to bug fixes (and add new
features to ksoap2 only).... Did you try whether ksoap2 (ksoap.org) fits
your needs???
Concerning the diff: AFAIK, cygwin contain a free diff tool....
It's really hard to discuss changes here without seeing what the changes
actually are.
Best,
Stefan
_______________________________________________
Ksoap mailing list
[email protected]
http://www.enhydra.org/mailman/listinfo.cgi/ksoap