Roxen.git / server / etc / modules / RXML.pmod / utils.pmod

version» Context lines:

Roxen.git/server/etc/modules/RXML.pmod/utils.pmod:1:   //! Things that belong elsewhere but can't lie there for various silly reasons.   //!   //! E.g. one reason is to avoid circular references in the parser   //! objects when the callbacks are defined in them.   //!   //! Created 2000-01-21 by Martin Stjernholm   //! - //! $Id: utils.pmod,v 1.2 2000/02/11 01:04:01 mast Exp $ + //! $Id: utils.pmod,v 1.3 2000/02/12 21:27:55 mast Exp $         array return_zero (mixed... ignored) {return 0;}   array return_empty_array (mixed... ignored) {return ({});}      int(1..1)|string|array unknown_tag_error (Parser.HTML p, string str)   {    RXML.rxml_fatal ("Unknown tag %O. Unknown tags are not "    "allowed in this context.\n", p->tag_name());    return ({});   }         // PHtml callbacks.      int(1..1)|string|array p_html_entity_cb (Parser.HTML p, string str)   {    string entity = p->tag_name();    if (sizeof (entity)) { -  if (entity[0] == '#') { +  if (entity[0] != '#') +  return p->handle_var (entity); +  if (p->type->quoting_scheme != "xml") { +  // Don't decode any normal entities if we're outputting xml-like stuff.    if (!p->type->free_text) return ({});    string out;    if ((<"#x", "#X">)[entity[..1]]) {    if (sscanf (entity, "%*2s%x%*c", int c) == 2) out = (string) ({c});    }    else    if (sscanf (entity, "%*c%d%*c", int c) == 2) out = (string) ({c});    return out && ({out});    } -  return p->handle_var (entity); +     }    return p->type->free_text ? 0 : ({});   }         // PHtmlCompat callbacks.      int(1..1)|string|array p_html_compat_tagmap_tag_cb (    Parser.HTML p, string str, mixed... extra)   {