RE: [libxml++] sax_parser example: entity not defined



On Tue, 2003-11-25 at 10:44, Murray Cumming Comneon com wrote:
> > Oh, it was my example that worked by encoding the references. 
> > The existing sax_parser is still substitutes, and calling 
> > SaxParser with false generates an error on a reference.
> 
> And that's what I'm concerned about. I find it surprising that libxml would
> be broken by default, so I worry that we have done something wrong. I will
> try to find the time to do those C tests.

Maybe "broken" is a strong word to use in the technical perspective. By
broken, I refer mostly to usability.

BTW, here is how librsvg's entity-related callbacks. You think we should
take this approach instead?

static xmlEntityPtr
rsvg_get_entity (void *data, const xmlChar *name)
{
	RsvgHandle *ctx = (RsvgHandle *)data;
	
	return (xmlEntityPtr)g_hash_table_lookup (ctx->entities, name);
}

static void
rsvg_entity_decl (void *data, const xmlChar *name, int type,
				  const xmlChar *publicId, const xmlChar *systemId, xmlChar
*content)
{
	RsvgHandle *ctx = (RsvgHandle *)data;
	GHashTable *entities = ctx->entities;
	xmlEntityPtr entity;
	char *dupname;

	entity = g_new0 (xmlEntity, 1);
	entity->type = type;
	entity->length = strlen (name);
	dupname = g_strdup (name);
	entity->name = dupname;
	entity->ExternalID = g_strdup (publicId);
	entity->SystemID = g_strdup (systemId);
	if (content)
		{
			entity->content = xmlMemStrdup (content);
			entity->length = strlen (content);
		}
	g_hash_table_insert (entities, dupname, entity);
}






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