Re: [xml] libxml incompatibility in version 2
- From: Daniel Veillard <veillard redhat com>
- To: Chema Celorio <chema ximian com>
- Cc: veillard redhat com, xml gnome org
- Subject: Re: [xml] libxml incompatibility in version 2
- Date: Mon, 11 Jun 2001 03:43:58 -0400
On Mon, Jun 11, 2001 at 01:30:16AM -0500, Chema Celorio wrote:
Hello dv,
I am porting a very small app to the 2.0 platform.
This is a piece of code that was working fine with the old
libxml :
===========================================
doc = xmlParseFile (full_path);
if (doc == NULL) {
g_warning ("File not found or file with errors [%s]", full_path);
return NULL;
}
if (doc->root == NULL) {
g_warning ("Invalid xml File, tree empty [%s]", full_path);
xmlFreeDoc (doc);
return NULL;
}
===================================
it is now failing in doc->root == NULL and giving a the warning :
"Invalid xml File, tree empty [/usr/share/glade2/widgets/catalog.xml]"
For some reason doc->root is now NULL.
It is the same xml file that I was using with the old xml. Libxml is not
generating any warnings at all. Do you have any idea on what can be
wrong ?
This should not compile, in libxml2 doc->root does not exist anymore.
As explained in the migration doc:
http://xmlsoft.org/upgrade.html
"Upgrading libxml client code from 1.x to 2.x"
Section "How to fix libxml-1.x code:", item 3:
"Use xmlDocGetRootElement(doc) to get the root element of a document."
So I think:
- you should double check your headers, because doc->root should
not compile
- once checked, use root = xmlDocGetRootElement(doc); to find the
root node of the document.
and in general check the upgrade doc, it should help :-)
Daniel
--
Daniel Veillard | Red Hat Network http://redhat.com/products/network/
veillard redhat com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]