Re: [xml] Refactoring of the SAX interface for namespace support.

On Wed, 13 Aug 2003 06:12:31 -0400
Daniel Veillard <veillard redhat com> wrote:

On Wed, Aug 13, 2003 at 10:39:45AM +0100, Dave Beckett wrote:
On Tue, 12 Aug 2003 11:05:50 -0400
      there is one thing to note, that a namespace() callback may actually
      provide the namepace binding for the element after startElementNs()
      was called like in <foo:bar xmlns:foo="bar"/>

Please no.  If you go with the second style, you really must generate
namespace() first before any names with that namespace.

  Hum, there isn't really a way around this. I don't think making namespace
callbacks before the element start is any better. 
   if you get an events flow of
     startElement(bar, ns,...)
     endElement(bar, ns,...)

you really expect 
     <foo xmlns:ns=...><ns:bar href=.../></foo>
   and not
     <foo><ns:bar xmlns:ns=... href=.../></foo>

yes.  Namespaces in XML says that the xmlns declarations
happen on all namespaced-names on that element
including attributes.  It would be really surprising if you
were told later "by the way, that was namespaced"
So the ordering should be:
  begin startElement
  1. namespaces declarations, [any other xml: stuff]
  2. element name, attributes in any order
  end startElement

If you chose to provide such standalone namespace information
you really have to keep to that.

  I think this would make scope detection more complex too.
This "use before declaration" is a property of the XML serialisation

But the serialisation order isn't everything.  Attribute ordering or
lack of it is another example.  If the xmlns=... is the last attribute
you still have to process it before any namespaced attributes.

This says to me that the other API choice is better - do the
namespace processing and deliver startElementNS in one


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]