Re: [xml] printing the value of a namespace



On Mon, Mar 10, 2003 at 05:20:30PM -0500, Nick Torenvliet wrote:
My code looks like this


xmlChar *out
cur = xmlDocGetElementRoot(doc);
printf("%s\n",cur->name);

and it give a seg fault.  

  So you dereference pointers without checking they are not NULL
first ??? I have no contextual information, I don't know how doc
was created, from what document, etc ...
  All I know is that accessing the name field of nodes works
for the thousand of places where I use them in the library, when 
possible depending on the node type. I think you should read
existing examples present on the web site and existing documentation,
like http://xmlsoft.org/example.html and make sure you understand
them before going further trying to develop your own code.
Oh and the use of a debugger is really the right way to debug your
your code, posting out of context fragments is basically useless,

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
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]