[xml] xml file parsing error

Greetings all,

  I am just started to work with the xml parser interface, but I have a problem here.
I was trying to parsing a xml file and test if it is ok, I want to get the element names
of the tree, but it just output like this:
keyword: glyph
keyword: text

here is the main function:
        xmlChar *key = NULL;
        xmlDocPtr glyphdb;
        xmlElement elem;
        xmlNodePtr cur;
        glyphdb = xmlReadFile("tutor.xml", NULL, 1);
        if (glyphdb == NULL ) {
                fprintf(stderr,"Document not parsed successfully. \n");
        cur = xmlDocGetRootElement(glyphdb);
        while (cur != NULL) {
                key = (xmlChar*) cur->name;
                printf("keyword:%s\n", key);
                cur = cur->children;

here's the xml file:
        <char codepoint="8AAA">
                <left codepoint="2F94">
                <right codepoint="514C">

Any suggetion  will be quite helpful, thx very much!


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