On Fri, Apr 11, 2008 at 8:58 AM, Ralf Junker <[EMAIL PROTECTED]> wrote: > At 17:42 10.04.2008, Andrew W. Nosenko wrote: > > >Sorry for question, but I'm curious why you need strlen()?.. I would > >to expect strcmp() rather... > > I need the length to pass it to other functions which do not work on > #0-terminated, but length-terminated string functions.
Hmm... What about following idea: You may try to cache length of strings. Const family of functions returns pointer to the "interned" string from the internal Reader dictionary. It relates to node and attribute names. You may prefill it with strings need for- or expected by you using xmlTextReaderConstString(). In the same time you can calculate strlen() and fill both (pointer to the interned string and its length) into e.g. array. After that you can both save time by eliminating strcmp() and using direct pointer comparison, and avoid strlen() calls using lookup inside this prefilled array. If lookup fails (unknown node or attribute), then you may fallback to the "usual" strlen() or just ignore unknown element depending of logic of your application. -- Andrew W. Nosenko <[EMAIL PROTECTED]> _______________________________________________ xml mailing list, project page http://xmlsoft.org/ xml@gnome.org http://mail.gnome.org/mailman/listinfo/xml