Menu

#2 ParserAdapter: prefixed atts before NS decl

closed-fixed
7
2001-08-03
2001-07-13
No

Reported by Michael Kay 2001-05-16:

There is an undocumented assumption in
org.xml.sax.helpers.NamespaceSupport
that
in a new namespace context, any declarePrefix() calls
will be made before
any processName() call. Otherwise a name may be
retrieved from the cache and
assigned the wrong namespace URI. This only happens if
a qname (of an
element or attribute) is used on one element, and the
same qname is used on
an ancestor element, but they bind to different
namespace URIs.

I've fixed the problem in the AElfred SAXDriver by
processing all the
namespace declarations before processing the "real"
attributes.

David: the SAX2 ParserAdapter (in the latest bug-fixed
version) calls
processName() for attributes as soon as they are
encountered, but if a
namespace declaration is then found, the processName()
is done again and the
original incorrect value is discarded. However, I don't
think this solves
the problem, because on the second call, the
(incorrect) value will be
retrieved from the cache held in NamespaceSupport. So I
think the same bug
is present in the SAX2 ParserAdapter (but I haven't
checked by testing it).

I haven't tried to change NamespaceSupport.

Discussion

  • Anonymous

    Anonymous - 2001-07-14
    • summary: Problem prefixed atts before NS decl --> NamespaceSupport, ParserAdapte: prefixed atts before NS decl
     
  • Anonymous

    Anonymous - 2001-07-30
    • assigned_to: nobody --> dbrownell
    • status: open --> open-accepted
     
  • Anonymous

    Anonymous - 2001-07-31

    Logged In: YES
    user_id=44117

    Yep, two bugs: (a) doc for NamespaceSupport,
    and (b) ParserAdapter needs to use two passes.
    I'm not sure yet about the caching issue; that
    might be due to not using separate passes.

     
  • Anonymous

    Anonymous - 2001-07-31

    Logged In: YES
    user_id=44117

    Given more info from Mike, I'm treating this
    bug report as (b) below, and 441056 as (a).
    Fixes to both are in the works.

     
  • Anonymous

    Anonymous - 2001-08-01
    • summary: NamespaceSupport, ParserAdapte: prefixed atts before NS decl --> ParserAdapter: prefixed atts before NS decl
     
  • Anonymous

    Anonymous - 2001-08-03
    • status: open-accepted --> closed-fixed
     

Log in to post a comment.