Expat namespace processing


Subject: Expat namespace processing
From: sam th (sam@bur-jud-118-039.rh.uchicago.edu)
Date: Tue Mar 14 2000 - 03:55:14 CST


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

For all you folks that want to use namespace in AbiWord documents, here's
an executive summary of the API stuff.

New functions -

1

XML_Parser XML_ParserCreateNS(const XML_Char *encoding, XML_Char
namespaceSeperator)

This function replaces XML_ParserCreate (which is still supported). The
easiest change is to use this to create the parser, instead of
XML_ParserCreate. This is all that needs to be done globally.
The XML_Char namespaceSeperator variable is what expat uses to seperate
the namespace from the name in that space. So, if you were using the SVG
construct <svg:path> the name would be represented as (uri to svg
namespace)(seperator here)path. Thus, the seperator need to be a
character not allowable in URIs. the | character is a good candidate.

2

XML_SetNamespaceDeclHandler(XML_Parser p, XML_StartNamespaceDeclHandler
start, XML_EndNamespaceDeclHandler end)

This function declares the appropriate namespace handelers for starting
and ending namespaces. They are declared according to the following
syntax:

typedef void (*XML_StartNamespaceDeclHandler)(void *userData,
                                              const XML_Char *prefix,
                                              const XML_Char *uri);

typedef void (*XML_EndNamespaceDeclHandler)(void *userData,
                                            const XML_Char *prefix);
          

to quote from the source:

/* When namespace processing is enabled, these are called once for
each namespace declaration. The call to the start and end element
handlers occur between the calls to the start and end namespace
declaration handlers. For an xmlns attribute, prefix will be null.
For an xmlns="" attribute, uri will be null. */

That's it.

For more info, see my previous post with refences.
 
                                     sam th
                                     sytobinh@uchicago.edu
                                http://bur-jud-118-039.rh.uchicago.edu
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE4zgyDt+kM0Mq9M/wRAle2AKCfYnkGf8saPld38o3njMBykUelrgCgtzMf
/ILwlsXgML292c5lSETEknE=
=71ZF
-----END PGP SIGNATURE-----



This archive was generated by hypermail 2b25 : Tue Mar 14 2000 - 03:55:14 CST