Re: [xml] xmlHashScan and *data argument



Melvyn Sopacua said:
On Sunday 19 October 2003 23:43, Daniel Veillard wrote:
On Sun, Oct 19, 2003 at 11:31:54PM +0200, Melvyn Sopacua wrote:
<snip>

I still don't get why xmlDumpElementDecl accepts buf as first
argument while
it is an xmlHashScanner on an xmlElementTable - the same as I'm
doing.

I won't dwell on it, but if you can explain it, I can sleep better
;)

Further investigation shows that xmlSchemaTypeDump in
xmlschema.c indeed
has the argument order you list and swapping the arguments in my
function
works.

  Okay, normal. There is actually  3rd argument passed if you look
at the
declaration of xmlHashScanner() in libxml/hash.h

hmmmm..... This thread has gotten my poor mind all twisted.  It
certainly seems to me that Melvyn has a "valid" point concerning the
scan callbacks for dumping data in valid.c.  Let's see... the
function def for the scanner callback is:

/**
 * xmlHashScanner:
 * @payload:  the data in the hash
 * @data:  extra scannner data
 * @name:  the name associated
 *
 * Callback when scanning data in a hash with the simple scanner.
 */
typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar
*name);

while the callback function in valid.c has:

/**
 * xmlDumpElementDecl:
 * @buf:  the XML buffer output
 * @elem:  An element table
 *
 * This will dump the content of the element declaration as an XML
 * DTD definition
 */
void
xmlDumpElementDecl(xmlBufferPtr buf, xmlElementPtr elem) {

and the corresponding callback function in xmlschemas.c has:

/**
 * xmlSchemaTypeDump:
 * @output:  the file output
 * @type:  a type structure
 *
 * Dump a SchemaType structure
 */
static void
xmlSchemaTypeDump(xmlSchemaTypePtr type, FILE * output)

It certainly looks as though it's worth reviewing the valid.c code....

Bill



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