Re: [xml] iterating an UTF-8 string (xmlChar)

On Wed, Jul 13, 2005 at 02:09:56PM +0200, Roberto Diaz wrote:

I am trying to figure out how to iterate thorught an xmlChar *.

I mean something like this:

for (unsigned int i = 0; xmlUTF8Strlen (myString); ++i)
      /// obiously this wont work
          myString[i] = ...;

How do I iterate the string?

  depends what you want to do with it

  while ( myString[i] != 0) {


  or you can use xmlGetUTF8Char() to go though each character code point
using the returned len to increment the i byte index.

Daniel Veillard      | Red Hat Desktop team
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]