Re: [xml] xmlTextReaderReadOuterXml and xmlTextReaderReadInnerXml
- From: Daniel Veillard <veillard redhat com>
- To: jwert ilstechnology com
- Cc: xml gnome org
- Subject: Re: [xml] xmlTextReaderReadOuterXml and xmlTextReaderReadInnerXml
- Date: Mon, 23 May 2005 04:33:34 -0400
On Sun, May 22, 2005 at 06:57:54PM -0400, jwert ilstechnology com wrote:
What would it take to get the following code pushed to the head? I'd do it
myself, but I'm not sure if you have some process you want to follow:
Humm, I initially hoped to be able to extract this directly from the
real input buffer, not a reserialized version. On the other hand it's
better to have a implemented API than an unimplemented block for 2 more
years :-)
doc = xmlNewDoc(NULL);
node = xmlDocCopyNode(node, doc, 1);
buff = xmlBufferCreate();
I don't understand why you copy the subtree in both call. First
it's inefficient, second you loose some of the characteristics of the
initial document like the encoding.
resbuf = xmlMalloc(buff->size + 1);
memcpy(resbuf, buff->content, buff->size);
resbuf[buff->size] = '\0';
I think it's better to return buff->content directly, one just need to
replace it by NULL in the structure before calling xmlBufferFree(buff);
I also could not spot the difference in your code between
xmlTextReaderReadInnerXml and xmlTextReaderReadOuterXml, might be an
oversight from me but they really should not have the same behaviour,
could you explain ?
So in the current state, I don't think this can be applied to the current
code, those 3 issues need to be resolved first but it should not be hard.
thanks,
Daniel
--
Daniel Veillard | Red Hat Desktop team 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]