Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread
Message: 94549
BY: Manuel Binna (mbinna)
DATE: 2010-08-16 11:52
SUBJECT: RE: SaxParser: Access attribute prefixes

 

I just found, that the underlying function start_element_ns_callback() in ruby_xml_sax2_handler.c processes the attributes as follows:

// ...

/* Each attribute is an array of [localname, prefix, URI, value, end] */
int i;
for (i = 0;i < nb_attributes * 5; i+=5)
{
VALUE attrName = rb_str_new2(xattributes[i+0]);
VALUE attrValue = rb_str_new(xattributes[i+3], xattributes[i+4] - xattributes[i+3]);
/* VALUE attrPrefix = xattributes[i+1] ? rb_str_new2(xattributes[i+1]) : Qnil;
VALUE attrURI = xattributes[i+2] ? rb_str_new2(xattributes[i+2]) : Qnil; */

rb_hash_aset(attributes, attrName, attrValue);
}

// ...

Because the prefix and the URI are commented out, it is logical that libxml-ruby does not provide them to the implementation of on_start_element_ns() callback. But why are they commented out?


Thread View

Thread Author Date
SaxParser: Access attribute prefixesManuel Binna2010-08-16 10:21
      RE: SaxParser: Access attribute prefixesManuel Binna2010-08-16 11:52

Post a followup to this message