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



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

  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
    StartElementNs(
           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
possibilities.

yes, this looks good.

The only thing missing to me is that the number of attributes is already
known but isn't returned here.  It would be nice to know that at this
point for initialising arrays once, rather than having to grow them as
each new attributeNs callback is invoked.  

Well, I'd actually like the lengths of all the xmlChar* to be returned
too, since you know them and the user app has to strlen() them again to
find out their sizes for copying.  Lots more strlen()ing than before
since you now have namespace URIs, prefixes and the localname itself
instead of just the localname.

Dave




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