On 26.09.2012 23:44, Paolo Bonzini wrote:

The braces are the important part here. These are not string, they are
NodeTag objects (it is documented: try "XML.Attribute comment"). Thus
you need:

aCollection do: [:each | dict at: each name asString put: each value ].

to build the dictionary.

Paolo.. You are correct -- as usual!  I didn't see that forest for the
trees either.. Your code above worked great and got me past the sticky
part and the above "asString" can be changed to "type" and works fine
that way as well.. One thing if you don't mind.. Can you please clue me
in on why the version on the XML GST page won't work as claimed?  The
code is below and does use associations -- however, I thought I saw code to deal with associations in Dictionary's when I was perusing the source
yesterday -- perhaps not? :

^Dictionary withAll: (aCollection
        collect: [ :each | each key type -> each value ])

This results in the following Dictionary object for the earlier
data :

An instance of Dictionary
  tally: 2
  contents: [
    1->'label'->'use-case-Name-1'
    2->'link'->'http://foobar.com'
  ]

While I do have a functional workaround I'm just curious and would like
to update that part of the GST docs if the examples are incorrect..
Thanks again for saving my bacon!

--Rick

_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to