[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-smalltalk] XML usage question..
From: |
Paolo Bonzini |
Subject: |
Re: [Help-smalltalk] XML usage question.. |
Date: |
Wed, 26 Sep 2012 09:08:03 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 |
Il 25/09/2012 20:29, Rick Flower ha scritto:
>
>
> 2) Got my array of use-case elements using the following code:
>
> (parser document root elementNamed: 'UseCases') elements reject: [:each
> | each isBlankText]
>
> For whatever reason the array for the returned element has
> empty entries in it -- and looks like the following in my
> case :
They are not empty, they correspond to the whitespace between <UseCases>
and <UseCase>.
If you want to ignore it, you need to create a subclass of DOM_SAXDriver
and override the #ignorableWhitespace: method. The overridden method
can simply do nothing. Then to use your driver call this before
starting the parse:
parser saxDriver: NoWhitespaceSAXDriver new
Paolo
>
> An instance of Array
> contents: [
> [1]:
>
> [2]: <UseCase>Use-Case #1</UseCase>
> [3]:
>
> [4]: <UseCase>Use-Case #2</UseCase>
> [5]:
>
> ]
>
> After running the above reject: code it becomes :
> An instance of Array
> contents: [
> [1]: <UseCase>Use-Case #1</UseCase>
> [2]: <UseCase>Use-Case #2</UseCase>
> ]