Re: [xml] Useless function calls in xmlSetProp()?

On Mon, Jan 28, 2008 at 03:26:02PM +0100, Julien Charbon wrote:
Daniel Veillard wrote:
On Fri, Jan 25, 2008 at 02:39:22PM +0100, Julien Charbon wrote:
"&myent;" -> (1) -> "&myent;" -> (2) -> "&myent;"

 argh, right .... I'm afraid the escaping has been added as an 
it was not supposed to be that way, oh well, one can still build the 
complex attrubute values 'by hand' with the help of the API, but I think
somehow we defeated the initial purpose for the xmlStringGetNodeList() call

It's give to me with current libxml2 trunk:
$ gcc test-xml-tiny.c -o test-xml-tiny $(xml2-config --cflags) \
  $(xml2-config --libs)
$ ./test-xml-tiny
Only one element in return of xmlStringGetNodeList
&foo; &bar; &amp; <tag> &myent </tag> &&

 No change. Maybe, historically, it was not always the case...

 Hum, yes. The only other thing that your suggested change would loose
are the error message resulting from the validations occuring in 
xmlEncodeEntitiesReentrant() , problems reported there would go unnoticed
otherwise. Is that still worth the extra complexity or not, I'm not sure.

 Hum, sure, UTF-8 validation shall not be removed. Anyway to evaluate 
this extra complexity, I made the simple program [see below] that do 
1000 iterations of xmlSetProp(node, name, value) and calculate the sum 
of all these calls with various 'value' parameter:

  okay, this makes a difference, agreed, is that really perceptible
on a real application run ? I'm unsure ...

Patch applied to current libxml2 trunk:
   But I tend to like the patch for a few reasons:
     - it cleans things up and show the actual process
     - it enforces the UTF-8 check in a clear manner
     - it doesn't change apparently the actual behaviour of the API

== tree.c.patch ==
  The patch looks fine to me, if you can provide the final version as an
email attachment, I will try to apply it,

  thanks !


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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