#2 Add an iterator to org.xml.sax.Attributes

closed-rejected
nobody
None
5
2001-09-26
2001-07-30
Dave Walend
No

Half the time I use the Attributes object, I have to
iterate through all of them using a for() loop.

I'd really rather have an Iterator of [over/for] the
attribute names, that I could get right out of the
Attributes object.

Sun's crew (bug #4479991) passed the buck.

Thanks,

Dave

Discussion

  • David Brownell
    David Brownell
    2001-07-30

    • labels: 340835 -->
    • summary: Add an iterator to org.xml.sax.Attribute --> Add an iterator to org.xml.sax.Attributes
     
  • David Brownell
    David Brownell
    2001-07-30

    Logged In: YES
    user_id=44117

    I'm not sure why another class would make such
    tasks any easier, or why only one iterator class
    would be needed. (One for XML 1.0 style names,
    another for namespace style names, ...) In any
    case this is an RFE not a bug.

     
  • Dave Walend
    Dave Walend
    2001-07-30

    Logged In: YES
    user_id=28600

    Not another class. Just an iterator() method. Something akin
    to the methods provided in the java collections kit.

    Dave

     
  • Logged In: NO

    sax

     
  • Logged In: NO

    Adding a new method would be a backwards-incompatible
    change to the interface. That kind of change needs a
    VERY strong justification, and I don't see one. Plus,
    it seems easier to use a "for" iterator (as well as
    more efficient).

    Assuming iterator() returns an Enumeration (rather than
    add a JDK 1.2 dependency to the API), the implication
    in the RFE is that the object should return names.
    Now, there are two kinds of names:

    - qNames ... not guaranteed to be present/usable,
    because of how SAX2 defines the "namespace-prefixes"
    feature (default makes qName presentation optional,
    and parsers need not support non-defaults settings).

    - { uri, lName } ... two separate items, and again
    that's not guaranteed to be usable ("namespaces"
    feature might be false).

    So the feature as described doesn't seem doable in
    general: there's no single solution that works in
    all cases, and having multiple solutions is a lot more
    complicated than always using a "for" loop.

    - dbrownell

     
  • David Brownell
    David Brownell
    2001-09-26

    Logged In: YES
    user_id=44117

    Closing -- won't change this, a "for(...)" loop
    is fine, an incompatible API change can't be
    justified just to address this RFE.

     
  • David Brownell
    David Brownell
    2001-09-26

    • status: open --> closed
     
  • David Brownell
    David Brownell
    2001-09-26

    • status: closed --> closed-rejected