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

On Wed, Aug 13, 2003 at 11:32:35AM +0100, Dave Beckett wrote:
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

  look at SAX.c function startElement(), I want to clean up that mess
So maybe it's not possible to separate startElement from the namespace 
declarations. Fine, but attributes could still be separated.
  So the Right API might be
           void *ctx,
           const xmlChar *localname;
           int nb_namespaces,          // number of namespace definitions
           const xmlChar **namespaces, // namespaces (prefix/URI pairs)
           const xmlChar *prefix,
           const xmlChar *URI
 Then have separate attributeNs() callbacks
That sounds quite clean to me, actually far better IMHO that the two other

   thanks for the feedback :-)


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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