You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by Wouter Cloetens <wc...@raleigh.ibm.com> on 2000/06/28 14:27:35 UTC
Re: Changes
On Wed, 28 Jun 2000 22:05:56 GMT, Harmeet Bedi wrote:
>This could be one way of representing a structure (from the URL in Glen's message)
><enc:Struct enc:structNameType='xsd:string' enc:structValueType='xsd:int'>
That would only work for a Hashtable with String keys and Integer values. How would you
determine that? java.util.Hashtable accepts any object as key or value. I don't know if
other programming languages are this forgiving.
How about more something like:
<enc:Struct enc:structNameType='xsd:ur-type' enc:structValueType='xsd:ur-type'>
<member>
<name xsi:type="xsd:string">lowerBound</name>
<value xsi:type="xsd:int">18</value>
</member>
<member>
<name xsi:type="xsd:string">upperBound</name>
<value xsi:type="xsd:int">139</value>
</member>
</enc:Struct>
> Another way could be
> <enc:Struct xsi:type="somnamespace:struct">
> <lowerBound xsi:type="xsd:string">18</lowerBound>
> <upperBound xsi:type="xsd:string">139</upperBound>
> </enc:Struct>
I like the efficiency of that, though you're locking yourself into String hash keys. If some
other language's implementation of hash table functionality requires that, it's probably a
good choice. The key values would also be restricted to valid XML element names (no
spaces, '>' characters etc).
Your implementation, btw, would throw a ClassCastException on non-String keys. It would
be a bit more forgiving with this change:
String key = (String)iter.next();
to
String key = iter.next().toString();
That way it would support Integers, Floats, Dates etc.
bfn, Wouter