Re: [xml] Run-time error during XML parse



Bill,
   Thanks for the enlightening reply. I have started
using xmllint to pre-validate XML documents that will
be used by my application. The run-time error has been
fixed.

However, I am still not able to correctly parse
sub-nodes of the root.
Code:
1.cur=xmlDocGetRootElement(doc);
2.cur=cur->xmlChildrenNode;
3.while(cur != NULL)
4.{
5.if((!xmlStrcmp(cur->name, "BUCKETS")))
6. {
  
7.key=xmlNodeListGetString(doc,cur->xmlChildrenNode,1);
8.printf("Node content: %s",key);
9.xmlFreeDoc(doc);
10.return cur;
11.  }
12. cur = cur->children (also tried next);
}
return NULL;
        child->name of the root->xmlNodeChildrenNode
is being returned as "text" whereas it should be
"ENTITY". I do not know as yet what to call this error
and could not find anything relevant on the 
archives by typing "erroneous child name". 

              If you could please show me where I can
find the answer, I would be thankful. 

Regards,
Sriram
PS: Request for everybody on the Mailing list.        
          

--- "William M. Brack" <wbrack mmm com hk> wrote:
Hello everyone,
    I am a newbie to LibXML. As part of my
project, I need to be
able to parse an XML document and retrieve the
attribute values
of a particular node.

I used code from John Fleck's Libxml tutorial and
tried to parse
this document:

I copied your test document from your mail, and
found there were a
couple of errors in the XML source (missing spaces
after quoted
atribute names).  After correcting those mistakes, I
tried to search
for nodes named "BUCKETS" using the utility
"testXpath" (included in
the source distribution), and it worked perfectly.

Please validate your source file (using xmllint)
before even
*thinking* about reporting an error, and then try
one of the library
utilities to determine whether the problem is more
likely in the
library or within your program.

Regards,
Bill

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com



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