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.4 2000/02/13 11:07:52 mast Exp $ + //! $Id: utils.pmod,v 1.5 2000/02/13 18:07:15 mast Exp $         array return_zero (mixed... ignored) {return 0;}   array return_empty_array (mixed... ignored) {return ({});}      int(1..1)|string|array free_text_error (Parser.HTML p, string str)   {    sscanf (str, "%[ \t\n\r]", string ws);    if (str != ws) {    sscanf (reverse (str), "%*[ \t\n\r]%s", str);    sscanf (reverse (str), "%*[ \t\n\r]%s", str); -  RXML.rxml_fatal ("Free text %O is not allowed in this context.\n", str); +  RXML.rxml_parse_error ("Free text %O is not allowed in this context.\n", str);    }    return ({});   }      int(1..1)|string|array unknown_tag_error (Parser.HTML p, string str)   { -  RXML.rxml_fatal ("Unknown tag %O. Unknown tags are not " +  RXML.rxml_parse_error ("Unknown tag %O. Unknown tags are not "    "allowed in this context.\n", p->tag_name());    return ({});   }    -  + int(1..1)|string|array output_error_cb (Parser.HTML p, string str) + { +  if (p->errmsgs) str = p->errmsgs + str, p->errmsgs = 0; +  if (p->type->free_text) p->_set_data_callback (0); +  else p->_set_data_callback (free_text_error); +  return ({str}); + }    - // PHtml callbacks. +     - int(1..1)|string|array p_html_entity_cb (Parser.HTML p, string str) + // PXml callbacks. +  + int(1..1)|string|array p_xml_entity_cb (Parser.HTML p, string str)   {    string entity = p->tag_name();    if (sizeof (entity)) {    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]]) {