pike.git / lib / modules / Parser.pmod / XML.pmod / Validating.pike

version» Context lines:

pike.git/lib/modules/Parser.pmod/XML.pmod/Validating.pike:76:    }   }      //! XML Element node.   protected class Element {       string name;    array(function) content_matcher;    mapping(string:array) attributes;    -  string _sprintf(int mode, mapping options) +  string _sprintf(int mode)    {    return mode=='O' && sprintf("%O(%O)", this_program, name);    }       int accept_element(string name)    {    array(function) step = (content_matcher(name)-({0}))*({});    if (!sizeof(step)) {    return 0;    }
pike.git/lib/modules/Parser.pmod/XML.pmod/Validating.pike:98:    return 1;    }       void check_attributes(mapping(string:string) c_attrs,    function(string, string, mixed ...:mixed) xmlerror)    {    foreach(indices(c_attrs), string name) {    array spec = attributes[name];    if(spec) {    if(!islegalattribute(c_attrs[name], spec)) { -  xmlerror(this_program::name, +  xmlerror(this::name,    "Invalid value for attribute %s: %O.", name, c_attrs[name]);    }    if(spec[1][0]=="#FIXED" && c_attrs[name]!=spec[1][1]) { -  xmlerror(this_program::name, +  xmlerror(this::name,    "Attribute %s must have the value %s.", name, spec[1][1]);    }    switch(spec[0][0]) {    case "ID":    if(__ids_used[c_attrs[name]]) { -  xmlerror(this_program::name, +  xmlerror(this::name,    "Id %O (sttribute %s) has already been used.",    c_attrs[name], name);    }    __ids_used[c_attrs[name]] = 1;    break;    case "IDREF":    __idrefs_used[c_attrs[name]] = 1;    break;    case "IDREFS":    __idrefs_used |=    mkmultiset(Array.uniq(replace(c_attrs[name],    ({"\t", "\r", "\n"}),    ({" ", " ", " "}) )/" "-({""})));    break;    case "ENTITY":    if(!__entity_ndata[c_attrs[name]]) { -  xmlerror(this_program::name, +  xmlerror(this::name,    "Invalid value for attribute %s: %O.",    name, c_attrs[name]);    }    break;    case "ENTITIES":    if(search(rows(__entity_ndata, replace(c_attrs[name],    ({"\t", "\r", "\n"}),    ({" ", " ", " "}) )/" "-    ({""})), 0)>=0) { -  xmlerror(this_program::name, +  xmlerror(this::name,    "Invalid value for attribute %s: %O.",    name, c_attrs[name]);    }    break;    case "NOTATION":    __notations_used[c_attrs[name]] = 1;    break;    }    } else if(name[..3]!="xml:") { -  xmlerror(this_program::name, "Undeclared attribute: %s.", name); +  xmlerror(this::name, "Undeclared attribute: %s.", name);    }    }    foreach (filter(indices(attributes)-indices(c_attrs),    lambda(string a) {    return attributes[a][1][0] ==    "#REQUIRED";    }), string attr) { -  xmlerror(this_program::name, +  xmlerror(this::name,    "Node %s is missing required attribute: %s.", name, attr);    };    }       void create(string _name)    {    content_matcher = __element_content[name = _name];    attributes = __element_attrs[name] || ([]);    }   }
pike.git/lib/modules/Parser.pmod/XML.pmod/Validating.pike:202:   //! @note   //! In Pike 7.7 and earlier @[info] had the value @expr{0@} (zero).   //!   //! @note   //! The default implementation always returns @expr{0@} (zero).   //! Override this function to provide other behaviour.   //!   //! @seealso   //! @[parse()], @[parse_dtd()]   string get_external_entity(string sysid, string|void pubid, -  mapping|__deprecated__(int)|void info, +  mapping|void info,    mixed ... extra)   {    // Override this function    return 0;   }      protected private array(function) accept_terminate(string x)   {    return !x && ({ accept_terminate });   }