Re: [xml] entity ref. in attribute value

Date view Thread view Subject view Author view

From: Petr Kozelka (pkozelka@centrum.cz)
Date: Wed Jun 28 2000 - 06:24:31 EDT


> Check the attribute() function in the SAX.c module.
> I think that if you ask for automatic entity replacement, then
> in that case you will get substituted values.

I looked at that function and understood that what I need is to call xmlStringDecodeEntities.
Ok, but this function always generates this error message: "xmlParseEntityRef: no name", although the entity reference has correct
syntax ("you & I")

my code looks like this:

... from inside the loop over attrs.:
/* an=attr.name; av=attr.value*/
    xmlChar* val = xmlStringDecodeEntities(aCtx->saxparser, (xmlChar*) av, XML_SUBSTITUTE_REF, 0,0,0);
    printf("%s=%s\n", an, av);
    xmlFree(val);

...
/* the handler for resolving entity */
static xmlEntityPtr XIM_OnGetEntity(XML_IMPORT_CONTEXT *aCtx, const CHAR *aName)
{
 xmlEntityPtr result = xmlGetPredefinedEntity(aName);
printf("XIM_OnGetEntity:%s='%s'\n", result->name, result->content);
 return result;
}
...

What am I doing wrong ?
Petr Kozelka

GN(CZ) Resources International, a.s. - http://www.gncz.cz
Corena Holding a.s. - http://www.corena.com
____________________________________________________________
Look at http://kozelka.hyperlink.cz/xmle - xmle, a DOM oriented XML editor

----
Message from the list xml@xmlsoft.org
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@xmlsoft.org


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Aug 02 2000 - 12:30:17 EDT