Il 25/09/2012 18:51, Rick Flower ha scritto:
> buildUseCaseCollectionFrom: aList [
>    aList detect: [:each | Transcript show: 'Element:' , (each
> characterData); cr ]
> ]
> 
>  stream := './requirements.xml' asFile readStream.
>  parser := XML.XMLParser new.
>  parser validate: false.
>  parser parse: stream.
> 
>  docroot := parser document root.
>  self buildUseCaseCollectionFrom: (docroot elementsNamed: 'UseCases').
> 
> ==============================================================
> 
> When I run it, I get the following output -- seems
> like the Collection of Use-Case Elements is not
> quite right.. I was expecting two "Element:" lines
> each with the respective Use-Case # element but not
> both bunched up as a single.. Any ideas on what I've
> messed up?
> 
> Element:
>                 Use-Case #1
>                 Use-Case #2

#detect: is not doing what you want.  It returns the first element for
which the block returns true.  Note that your block does not return a
boolean in the first place.

I think this is returning all the character-data inside the <UseCases>
element, discarding the elements.

Paolo

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

Reply via email to