Re: [xml] Smart way to get ancestors?



On Fri, Jul 07, 2006 at 09:11:35PM +0200, Michael Ransburg wrote:
Hi!

A small update, this is the way I retrieve the ancestors now:

      node = xmlTextReaderExpand(reader);

      node->children = NULL;
      node->prev = NULL;
      node->next = NULL;

      while (node->parent != NULL) {
              node = node->parent;
      }
      xmlDocSetRootElement(doc,xmlCopyNode(node->children,1));

This works fine - is it a proper way to accomplish this?

  Why are you using the reader (i.e streaming) when it seems you
need full tree informations ?
  Modifying a node or document being processed by a reader is not
proper, that should be considered read-only really.

Daniel

-- 
Daniel Veillard      | Red Hat http://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]